refactor(api): build list, search and session services through one launch_served

This commit is contained in:
imSp4rky
2026-11-29 14:28:47 -07:00
parent e41760c2b3
commit de2ffcb9bd
22 changed files with 444 additions and 280 deletions
+5 -2
View File
@@ -8,6 +8,7 @@ from types import SimpleNamespace
import pytest
from tests.remote.sessions import stub_service_build
from unshackle.core.api import handlers, job_admission, key_policy, server_keys
from unshackle.core.api.errors import APIError
from unshackle.core.api.key_policy import KeyPolicy
@@ -142,7 +143,8 @@ def test_a_session_keeps_identity_keys_from_the_client_unless_the_identity_is_th
monkeypatch.setattr(handlers, "request_policy", lambda request: user)
monkeypatch.setattr(handlers, "choose_session_cdm", lambda *args: (server_cdm, None))
monkeypatch.setattr(handlers.Services, "load", lambda service: Service)
monkeypatch.setattr(handlers, "create_service_instance", lambda *args, **kwargs: (Service(), None, None))
stub_service_build(monkeypatch, Service)
monkeypatch.setattr(handlers, "load_client_cookies", lambda text: text)
async def run():
data = {"service": "EXAMPLE", "title_id": "t", "cookies": "x", "cache": {"keys/planted": text}, **sent}
@@ -177,7 +179,8 @@ def test_a_service_on_the_lent_device_makes_a_lent_device_session(server, monkey
monkeypatch.setattr(handlers, "request_policy", lambda request: KeyPolicy({"server_vault": True}))
monkeypatch.setattr(handlers, "choose_session_cdm", lambda *args: (False, None))
monkeypatch.setattr(handlers.Services, "load", lambda service: Service)
monkeypatch.setattr(handlers, "create_service_instance", lambda *args, **kwargs: (Service(), "x", None))
stub_service_build(monkeypatch, Service)
monkeypatch.setattr(handlers, "load_client_cookies", lambda text: text)
async def run():
data = {"service": "EXAMPLE", "title_id": "t", "cookies": "x", "cdm_type": "widevine", "cdm_relay": True}