mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-30 13:05:08 +00:00
refactor(tracks): make complete_track the one finish step for every track kind
This commit is contained in:
@@ -95,9 +95,24 @@ def test_the_source_defaults_leave_a_track_alone() -> None:
|
||||
assert svc.get_playready_license(challenge=b"", title=None, track=None) is None # type: ignore[arg-type]
|
||||
with pytest.raises(NotImplementedError):
|
||||
svc.get_sample_decrypter(None, 1) # type: ignore[arg-type]
|
||||
assert svc.sample_decrypter(None) is None # type: ignore[arg-type]
|
||||
svc.close()
|
||||
|
||||
|
||||
def test_a_source_that_decrypts_samples_hands_its_decrypter_for_the_track() -> None:
|
||||
class Decrypting(ExampleService):
|
||||
def decrypts_samples(self, track: Any) -> bool:
|
||||
return track == "EXAMPLE"
|
||||
|
||||
def get_sample_decrypter(self, track: Any, entry: int) -> bytes:
|
||||
return f"{track}:{entry}".encode()
|
||||
|
||||
svc = object.__new__(Decrypting)
|
||||
decrypter = svc.sample_decrypter("EXAMPLE") # type: ignore[arg-type]
|
||||
assert decrypter is not None and decrypter(2) == b"EXAMPLE:2"
|
||||
assert svc.sample_decrypter("OTHER") is None # type: ignore[arg-type]
|
||||
|
||||
|
||||
def test_a_playready_stub_names_every_kid() -> None:
|
||||
stub = drm_stub("playready", KIDS)
|
||||
assert isinstance(stub, PlayReady)
|
||||
|
||||
Reference in New Issue
Block a user