mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-06-08 17:20:22 +08:00
feat(browser): migrate to CloakBrowser for browser emulation and streamline dependency management
- Replace Playwright-based browser emulation with CloakBrowser as default - Update config to support CloakBrowser options and humanization presets - Refactor browser helper to use CloakBrowser context and remove cf_clearance dependency - Update Dockerfile, entrypoint, and update scripts to install CloakBrowser runtime - Ensure CloakBrowser kernel is pre-installed during local setup and dependency updates - Add tests for CloakBrowser integration and legacy compatibility
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import tempfile
|
||||
import unittest
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
@@ -58,6 +59,35 @@ class LocalSetupConfigDirTests(unittest.TestCase):
|
||||
self.assertIsNone(result)
|
||||
prompt_mock.assert_not_called()
|
||||
|
||||
def test_install_deps_installs_browser_runtime(self):
|
||||
module = load_local_setup_module()
|
||||
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
venv_dir = (Path(temp_dir) / "venv").resolve()
|
||||
venv_python = venv_dir / "bin" / "python"
|
||||
venv_pip = venv_dir / "bin" / "pip"
|
||||
|
||||
with patch.object(module, "ensure_supported_python"), \
|
||||
patch.object(
|
||||
module,
|
||||
"configure_venv_pip_compat",
|
||||
return_value=venv_pip,
|
||||
), \
|
||||
patch.object(module, "run") as run_mock, \
|
||||
patch.object(module, "install_browser_runtime") as install_browser:
|
||||
result = module.install_deps(
|
||||
python_bin="python3",
|
||||
venv_dir=venv_dir,
|
||||
recreate=False,
|
||||
)
|
||||
|
||||
self.assertEqual(result, venv_python)
|
||||
run_mock.assert_any_call(["python3", "-m", "venv", str(venv_dir)])
|
||||
run_mock.assert_any_call(
|
||||
[str(venv_pip), "install", "-r", str(module.ROOT / "requirements.txt")]
|
||||
)
|
||||
install_browser.assert_called_once_with(venv_python)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user