refactor(api): give every served service its dl options from the run plan

This commit is contained in:
imSp4rky
2026-11-28 14:02:44 -07:00
parent 63dd037ebd
commit 053d83874d
18 changed files with 285 additions and 205 deletions
+3 -2
View File
@@ -21,6 +21,7 @@ from unshackle.core.api.input_bridge import InputBridge
from unshackle.core.cdm.client_relay import ClientDeviceCdm, answer_cdm_call
from unshackle.core.launch import served_context
from unshackle.core.remote_protocol import APIErrorCode, AuthStatus
from unshackle.core.run_plan import served_plan
from unshackle.core.utils.click_types import ContextData
pytestmark = pytest.mark.unit
@@ -174,7 +175,7 @@ def test_a_relaying_client_gets_a_stand_in_with_its_device_facts(monkeypatch: py
monkeypatch.setattr(
handlers,
"served_context",
lambda obj, params, keys: built.update(cdm=obj.cdm, config=obj.config, params={**params, **keys}),
lambda obj, plan, keys: built.update(cdm=obj.cdm, config=obj.config, params={**plan.params, **keys}),
)
monkeypatch.setattr(handlers.Services, "load", lambda tag: Declares)
monkeypatch.setattr(handlers, "instantiate_service", lambda *a, **k: "service")
@@ -502,7 +503,7 @@ def test_a_lent_device_without_the_vault_grant_asks_the_server_for_no_key() -> N
@pytest.mark.parametrize("params", [{}, {"quality": None}])
def test_every_service_context_defaults_quality_to_a_list(params: Any) -> None:
parent = served_context(ContextData(config={}, cdm=None, proxy_providers=[]), params, {})
parent = served_context(ContextData(config={}, cdm=None, proxy_providers=[]), served_plan(params), {})
assert parent.params["quality"] == []