test: delete slow, timing-based and redundant tests

This commit is contained in:
imSp4rky
2026-12-05 15:20:05 -07:00
parent 783a2fc185
commit 3a0a74e694
292 changed files with 153 additions and 15174 deletions
@@ -302,17 +302,6 @@ def playready_env(monkeypatch):
monkeypatch.setattr("unshackle.core.cdm.load_cdm", no_device)
def test_playready_raises_the_refusal_before_the_device_loads(playready_env):
refusal = server_keys.live_licence_refusal(
session_entry(licensing=LicensingMode(Licensor.SERVER_CDM, 1080)), video(2160)
)
with pytest.raises(APIError) as ei:
server_keys.handle_single_server_cdm(
SimpleNamespace(), SimpleNamespace(), video(2160), "cHNzaA==", "playready", None, {}, refusal
)
assert ei.value is refusal
KID = UUID("161219ec3df64e0eadbb3827c0ccc46d")
CAP_DETAILS = {"reason": "server_cdm_max_height", "max_height": 1080}
@@ -434,14 +423,6 @@ def test_a_capped_answer_to_the_track_licence_moves_dl_to_the_local_device():
assert svc.client_licensed == {"vid"}
def test_a_capped_hls_track_with_no_drm_yet_moves_to_the_local_device():
track = SimpleNamespace(id="vid", drm=[], drm_preference=None)
svc = remote_session(SimpleNamespace(is_playready=False, security_level=1), CAPPED)
svc.batch_keys(one_title(track))
assert svc.client_licensed == {"vid"}
assert track.drm_preference == "widevine"
def test_batch_keys_forgets_the_last_titles_handovers():
track = SimpleNamespace(id="vid", drm=[_WV()], drm_preference=None)
svc = remote_session(SimpleNamespace(is_playready=False, security_level=1), {"keys": {}})
@@ -568,13 +549,6 @@ def test_a_cdm_entry_that_did_not_load_the_device_warns_and_does_not_decline(loc
assert "cdm entry for EXAMPLE1" in caplog.text
def test_server_cdm_true_does_not_warn_about_a_cdm_entry_that_loaded_no_device(caplog):
with caplog.at_level(logging.WARNING):
_, data = sent_create(True, cdm_map={"example1": {">=1080": "my_device"}})
assert "server_cdm" not in data
assert not caplog.text
@pytest.mark.parametrize(
("entry", "profile", "names"),
[
@@ -592,11 +566,6 @@ def test_which_cdm_entries_name_a_device_with_no_quality(entry, profile, names):
assert cdm_entry_names_device(entry, profile) is names
def test_a_client_with_no_device_does_not_decline():
_, data = sent_create(False, None, local_cdm=None)
assert "server_cdm" not in data
def created(answer, monkeypatch):
"""Run ``authenticate()`` to its end for a device the service's cdm entry loaded."""
svc, _ = sent_create(None, cdm_entry=True, cdm_map={"EXAMPLE1": "my_device"})
@@ -608,21 +577,6 @@ def created(answer, monkeypatch):
return svc
def test_the_client_says_when_a_cdm_entry_gave_the_licensing_to_its_device(caplog, monkeypatch):
with caplog.at_level(logging.INFO):
svc = created({"server_cdm": False}, monkeypatch)
assert svc.expected_server_cdm is False
assert "cdm config has an entry for EXAMPLE1" in caplog.text
def test_the_client_does_not_claim_its_device_when_the_server_keeps_the_server_cdm(caplog, monkeypatch):
with caplog.at_level(logging.INFO):
svc = created({"server_cdm": True, "server_cdm_max_height": 1080}, monkeypatch)
assert svc.expected_server_cdm is True
assert "your own device is not used" in caplog.text
assert "cdm config has an entry" not in caplog.text
@pytest.mark.parametrize(
("cdm", "override", "cdm_map", "expected"),
[
@@ -641,34 +595,6 @@ def test_dl_records_whether_the_services_cdm_entry_named_the_loaded_device(cdm,
assert runner.cdm_from_service_entry() is expected
@pytest.mark.parametrize("max_height", [None, 1080])
def test_a_declined_server_cdm_that_the_server_keeps_is_reported(max_height, caplog):
svc = remote_session(SimpleNamespace(is_playready=False), {})
svc.service_tag = "EXAMPLE1"
with caplog.at_level(logging.INFO):
svc.adopt_session_cdm(LicensingMode(Licensor.SERVER_CDM, max_height), False)
assert svc.expected_server_cdm is True
assert "your own device is not used" in caplog.text
assert "pass a higher -q" not in caplog.text
caplog.clear()
with caplog.at_level(logging.WARNING):
svc.adopt_session_cdm(LicensingMode(Licensor.SERVER_CDM, max_height), True)
assert "your own device is not used" not in caplog.text
@pytest.mark.parametrize(("cdm_entry", "level"), [(True, logging.INFO), (False, logging.WARNING)])
def test_a_refused_server_cdm_warns_only_when_no_cdm_entry_loaded_the_fallback(cdm_entry, level, caplog):
svc = remote_session(SimpleNamespace(is_playready=False), {})
svc.service_tag = "EXAMPLE1"
svc.ctx.obj.cdm_entry = cdm_entry
with caplog.at_level(logging.INFO):
svc.adopt_session_cdm(LicensingMode(Licensor.CLIENT_DEVICE), True)
assert svc.expected_server_cdm is False
[record] = [r for r in caplog.records if "falling back to the local CDM" in r.getMessage()]
assert record.levelno == level
@pytest.mark.parametrize("apply_overrides", [True, False])
@pytest.mark.parametrize(
("server_level", "service_entry", "expected"),