mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-03 22:45:09 +00:00
refactor(drm): hand the server key batch to one installer as a KeyBatch value
This commit is contained in:
@@ -17,7 +17,7 @@ import pytest
|
||||
from pywidevine.pssh import PSSH
|
||||
|
||||
from tests.core.key_resolver import key_table, resolver
|
||||
from tests.remote.key_source import remote_keys
|
||||
from tests.remote.key_source import one_title, remote_keys, remote_session
|
||||
from tests.remote.sessions import hold_session, session_entry
|
||||
from unshackle.core import remote_channel
|
||||
from unshackle.core.api import handlers, server_keys
|
||||
@@ -62,7 +62,7 @@ def client(posts: list) -> RemoteService:
|
||||
def test_the_server_vault_posts_only_the_pairs_the_server_did_not_serve() -> None:
|
||||
posts: list = []
|
||||
svc = client(posts)
|
||||
svc.note_vault_keys({SERVED.hex: KEY}, set())
|
||||
svc.served_keys.add((SERVED, KEY))
|
||||
|
||||
assert svc.server_vault.add_keys("EXAMPLE", {LICENSED: KEY, SERVED: KEY}, SimpleNamespace(id="v1")) == 0
|
||||
svc.server_vault.add_keys("EXAMPLE", {SERVED: KEY}, SimpleNamespace(id="v1"))
|
||||
@@ -114,9 +114,14 @@ def test_a_failed_post_is_dropped_and_logs_nothing(caplog: pytest.LogCaptureFixt
|
||||
|
||||
|
||||
def test_every_served_pair_is_remembered_whatever_its_source() -> None:
|
||||
svc = remote_keys()
|
||||
svc.note_vault_keys({VAULTED.hex: KEY, SERVED.hex: OTHER_KEY}, {VAULTED.hex})
|
||||
svc = remote_session(
|
||||
None, {"keys": {"vid": {VAULTED.hex: KEY, SERVED.hex: OTHER_KEY}}, "vault_keys": [VAULTED.hex]}
|
||||
)
|
||||
|
||||
batch = svc.batch_keys(one_title(SimpleNamespace(id="vid", drm=None)))
|
||||
|
||||
assert svc.served_keys == {(VAULTED, KEY), (SERVED, OTHER_KEY)}
|
||||
assert batch.tracks["vid"].vault_kids == {VAULTED}
|
||||
|
||||
|
||||
def decrypt(
|
||||
@@ -322,7 +327,7 @@ def test_cdm_only_declines_the_server_cdm_and_its_vault(monkeypatch, tmp_path) -
|
||||
svc.authenticate()
|
||||
assert svc.posts[0]["server_cdm"] is False
|
||||
assert (svc.key_arrival, svc.licensing.vault_first) == (KeyArrival.CALLBACK, False)
|
||||
svc.resolve_server_keys(SimpleNamespace(tracks=SimpleNamespace(videos=["v"], audio=[])))
|
||||
svc.batch_keys(SimpleNamespace(tracks=SimpleNamespace(videos=["v"], audio=[])))
|
||||
assert len(svc.posts) == 1
|
||||
finally:
|
||||
svc.close()
|
||||
|
||||
Reference in New Issue
Block a user