refactor(core): move login state to core.login and load key vaults through one factory

This commit is contained in:
imSp4rky
2026-11-25 15:31:37 -07:00
parent 5ba0a5474c
commit fba28198d0
14 changed files with 359 additions and 249 deletions
@@ -186,8 +186,8 @@ def test_setup_list_service_threads_request(monkeypatch):
monkeypatch.setattr(handlers, "load_full_cdm", lambda *args: None)
monkeypatch.setattr(handlers.Services, "load", lambda service: None)
monkeypatch.setattr(handlers, "instantiate_service", lambda *args: FakeService())
monkeypatch.setattr("unshackle.commands.dl.dl.get_cookie_jar", staticmethod(lambda service, profile: None))
monkeypatch.setattr("unshackle.commands.dl.dl.get_credentials", staticmethod(lambda service, profile: None))
monkeypatch.setattr("unshackle.core.login.get_cookie_jar", lambda service, profile: None)
monkeypatch.setattr("unshackle.core.login.get_credentials", lambda service, profile: None)
req = request("plainkey")
handlers.setup_list_service({}, "EXAMPLE", None, "some-title", req)
@@ -204,8 +204,8 @@ def test_search_reports_failed_proxy_check_as_invalid_proxy(monkeypatch):
monkeypatch.setattr(handlers, "load_full_cdm", lambda *args: None)
monkeypatch.setattr(handlers.Services, "load", lambda service: None)
monkeypatch.setattr(handlers, "instantiate_service", failed_check)
monkeypatch.setattr("unshackle.commands.dl.dl.get_cookie_jar", staticmethod(lambda service, profile: None))
monkeypatch.setattr("unshackle.commands.dl.dl.get_credentials", staticmethod(lambda service, profile: None))
monkeypatch.setattr("unshackle.core.login.get_cookie_jar", lambda service, profile: None)
monkeypatch.setattr("unshackle.core.login.get_credentials", lambda service, profile: None)
with pytest.raises(APIError) as exc_info:
handlers.run_service_search({}, "EXAMPLE", "query", request("plainkey"))
+2 -2
View File
@@ -64,8 +64,8 @@ def seen(tmp_path, monkeypatch):
monkeypatch.setattr(handlers, "resolve_server_account", lambda *args: None)
monkeypatch.setattr(handlers, "load_full_cdm", lambda *args: None)
monkeypatch.setattr(handlers.Services, "load", staticmethod(lambda service: module))
monkeypatch.setattr("unshackle.commands.dl.dl.get_cookie_jar", staticmethod(lambda service, profile: None))
monkeypatch.setattr("unshackle.commands.dl.dl.get_credentials", staticmethod(lambda service, profile: None))
monkeypatch.setattr("unshackle.core.login.get_cookie_jar", lambda service, profile: None)
monkeypatch.setattr("unshackle.core.login.get_credentials", lambda service, profile: None)
return _CacheService.seen