refactor(tracks): make complete_track the one finish step for every track kind

This commit is contained in:
imSp4rky
2026-11-29 14:04:53 -07:00
parent dcbc9de7ba
commit e41760c2b3
14 changed files with 332 additions and 174 deletions
+15
View File
@@ -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)