mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-04 15:05:08 +00:00
refactor(manifests): build the HLS key plan once and read it in every HLS licence pass
This commit is contained in:
@@ -18,8 +18,8 @@ from tests.core.test_hls_service_drm_keys import (
|
||||
SKD_KEY,
|
||||
InitServer,
|
||||
download,
|
||||
encrypted_init,
|
||||
hls_video,
|
||||
init_kid_probe,
|
||||
playlist,
|
||||
)
|
||||
from tests.lang_selection import test_kind_only_selection as harness
|
||||
@@ -68,16 +68,14 @@ class Bridged(Example):
|
||||
return "<License/>" if drm_system == "playready" else b"LIC"
|
||||
|
||||
|
||||
def test_a_fairplay_only_track_is_refused_without_the_hook(tmp_path: Path, monkeypatch: Any) -> None:
|
||||
def test_a_fairplay_only_track_is_refused_without_the_hook(tmp_path: Path) -> None:
|
||||
track = hls_video(tmp_path, playlist(SKD_KEY))
|
||||
probe = init_kid_probe(monkeypatch, KID)
|
||||
session = InitServer()
|
||||
session = InitServer(init=encrypted_init(KID))
|
||||
|
||||
with pytest.raises(NotImplementedError, match="None of the key systems are supported"):
|
||||
download(track, cdm_type_stub("playready"), session=session, fairplay_bridge=False)
|
||||
|
||||
assert not track.drm
|
||||
assert not probe.called
|
||||
assert not session.requests
|
||||
|
||||
|
||||
@@ -102,23 +100,27 @@ def test_a_bridged_challenge_goes_to_the_hook_and_every_other_to_the_system_call
|
||||
assert keys.service.calls == [(route, expected)]
|
||||
|
||||
|
||||
def test_drm_preference_picks_the_system_of_the_stub(tmp_path: Path, monkeypatch: Any) -> None:
|
||||
def test_drm_preference_picks_the_system_of_the_stub(tmp_path: Path) -> None:
|
||||
track = hls_video(tmp_path, playlist(SKD_KEY))
|
||||
track.drm_preference = "pr"
|
||||
init_kid_probe(monkeypatch, KID)
|
||||
licensed: list[str] = []
|
||||
|
||||
download(track, cdm_type_stub("widevine"), lambda drm, track_kid=None: licensed.append(type(drm).__name__), True)
|
||||
download(
|
||||
track,
|
||||
cdm_type_stub("widevine"),
|
||||
lambda drm, track_kid=None: licensed.append(type(drm).__name__),
|
||||
True,
|
||||
InitServer(init=encrypted_init(KID)),
|
||||
)
|
||||
|
||||
assert licensed == ["PlayReady"]
|
||||
assert track.drm is not None and track.drm[0].bridged
|
||||
|
||||
|
||||
def test_the_drm_of_the_service_needs_no_hook(tmp_path: Path, monkeypatch: Any) -> None:
|
||||
def test_the_drm_of_the_service_needs_no_hook(tmp_path: Path) -> None:
|
||||
"""A service that puts its own stub on a FairPlay-only track keeps its route, with no hook."""
|
||||
track = hls_video(tmp_path, playlist(SKD_KEY))
|
||||
track.drm = [drm_stub("playready", [KID.hex])]
|
||||
init_kid_probe(monkeypatch, KID)
|
||||
licensed: list[tuple[str, UUID | None]] = []
|
||||
|
||||
download(
|
||||
@@ -126,6 +128,7 @@ def test_the_drm_of_the_service_needs_no_hook(tmp_path: Path, monkeypatch: Any)
|
||||
cdm_type_stub("widevine"),
|
||||
lambda drm, track_kid=None: licensed.append((type(drm).__name__, track_kid)),
|
||||
licence_only=True,
|
||||
session=InitServer(init=encrypted_init(KID)),
|
||||
fairplay_bridge=False,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user