forked from kenzuya/unshackle
fix(cdm): read every device's DRM system through one CDM catalogue
This commit is contained in:
@@ -108,7 +108,7 @@ def test_bad_key_config_is_refused_at_load(server, monkeypatch, user_cfg, proble
|
||||
|
||||
def test_a_known_device_passes_validation(server, monkeypatch):
|
||||
monkeypatch.setattr(handlers.Services, "get_tags", staticmethod(lambda: ["EXAMPLE"]))
|
||||
monkeypatch.setattr(handlers, "detect_cdm_type", lambda name, cfg: "playready")
|
||||
monkeypatch.setattr(handlers, "device_system", lambda name, cfg: "playready")
|
||||
assert handlers.key_config_error("u", {"cdm": {"EXAMPLE": {"playready": "dev"}}, "service_config": {}}) is None
|
||||
assert handlers.key_config_error("u", {"cdm": {"EXAMPLE": {"default": "dev"}}, "service_config": None}) is None
|
||||
assert handlers.key_config_error("u", {"cdm": {"EXAMPLE": {"widevine": "dev"}}}) is not None
|
||||
|
||||
@@ -21,7 +21,7 @@ def widevine_configured(monkeypatch):
|
||||
app_config, "cdm", {"SVC": {"<=1080": "wv_l3", ">1080": "wv_l1", "default": "wv_l3"}}, raising=False
|
||||
)
|
||||
# every resolved device name is a Widevine device
|
||||
monkeypatch.setattr(handlers, "detect_cdm_type", lambda name, cfg: "widevine")
|
||||
monkeypatch.setattr(handlers, "device_system", lambda name, cfg: "widevine")
|
||||
|
||||
def fail_load(*args, **kwargs):
|
||||
raise AssertionError("load_cdm must not run for a mismatched type")
|
||||
@@ -39,7 +39,7 @@ def test_widevine_client_loads_the_configured_device(monkeypatch):
|
||||
from unshackle.core.config import config as app_config
|
||||
|
||||
monkeypatch.setattr(app_config, "cdm", {"SVC": {"default": "wv_l3"}}, raising=False)
|
||||
monkeypatch.setattr(handlers, "detect_cdm_type", lambda name, cfg: "widevine")
|
||||
monkeypatch.setattr(handlers, "device_system", lambda name, cfg: "widevine")
|
||||
loaded = {}
|
||||
monkeypatch.setattr("unshackle.core.cdm.load_cdm", lambda name, service_name=None: loaded.setdefault("n", name))
|
||||
handlers.load_full_cdm("SVC", None, "widevine")
|
||||
|
||||
@@ -97,7 +97,7 @@ def env(monkeypatch):
|
||||
monkeypatch.setattr(handlers.config, "serve", {"users": {}}, raising=False)
|
||||
# the device name says what the device is, in place of the .wvd / .prd file on disk
|
||||
monkeypatch.setattr(
|
||||
handlers, "detect_cdm_type", lambda name, cfg: {"wv": "widevine", "pr": "playready"}.get(name[:2])
|
||||
handlers, "device_system", lambda name, cfg: {"wv": "widevine", "pr": "playready"}.get(name[:2])
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user