mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-06 07:55:10 +00:00
test: delete slow, timing-based and redundant tests
This commit is contained in:
@@ -10,10 +10,8 @@ from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
from unshackle.commands.dl import cdm_summary
|
||||
from unshackle.core.api import server_keys
|
||||
from unshackle.core.cdm.client_relay import ClientDeviceCdm
|
||||
from unshackle.core.cdm.detect import cdm_system, cdm_type_stub, is_playready_cdm, is_remote_cdm, is_widevine_cdm
|
||||
from unshackle.core.cdm.detect import is_playready_cdm, is_remote_cdm, is_widevine_cdm
|
||||
from unshackle.core.cdm.loader import device_system, load_cdm
|
||||
from unshackle.core.config import config
|
||||
|
||||
@@ -49,17 +47,6 @@ def app_config(tmp_path, entries=(), cdm=None):
|
||||
return SimpleNamespace(remote_cdm=list(entries), directories=folders, cdm=cdm or {})
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("entry", "system"), ENTRIES)
|
||||
def test_config_and_the_built_cdm_agree(entry, system, tmp_path, monkeypatch):
|
||||
entry = {"name": "x", **entry}
|
||||
assert device_system("x", app_config(tmp_path, [entry])) == system
|
||||
|
||||
monkeypatch.setattr(config, "remote_cdm", [entry])
|
||||
cdm = load_cdm("x", service_name="EXAMPLE")
|
||||
assert cdm_system(cdm) == system
|
||||
assert is_remote_cdm(cdm)
|
||||
|
||||
|
||||
def test_the_server_settles_a_service_on_its_remote_device_system(tmp_path):
|
||||
entry = {"name": "x", "type": "decrypt_labs", "secret": "s", "device_name": "SL3000"}
|
||||
assert (
|
||||
@@ -87,13 +74,6 @@ def test_an_unknown_name_is_no_device(tmp_path, monkeypatch):
|
||||
load_cdm("x")
|
||||
|
||||
|
||||
def test_stand_ins_carry_their_system():
|
||||
assert cdm_system(cdm_type_stub("playready")) == "playready"
|
||||
assert cdm_system(cdm_type_stub("None")) == "widevine"
|
||||
assert cdm_system(ClientDeviceCdm(SimpleNamespace(), is_playready=True)) == "playready"
|
||||
assert not is_remote_cdm(cdm_type_stub("widevine"))
|
||||
|
||||
|
||||
def test_library_cdms_are_known_by_class():
|
||||
from pyplayready.cdm import Cdm as PlayReadyCdm
|
||||
from pyplayready.remote.remotecdm import RemoteCdm as PlayReadyRemoteCdm
|
||||
@@ -105,21 +85,3 @@ def test_library_cdms_are_known_by_class():
|
||||
assert is_widevine_cdm(object.__new__(WidevineCdm))
|
||||
assert is_widevine_cdm(remote_wv) and is_remote_cdm(remote_wv)
|
||||
assert is_remote_cdm(object.__new__(PlayReadyRemoteCdm))
|
||||
|
||||
|
||||
@pytest.mark.parametrize("cdm", [None, object()])
|
||||
def test_no_cdm_is_neither_system(cdm):
|
||||
assert cdm_system(cdm) is None
|
||||
assert not is_playready_cdm(cdm) and not is_widevine_cdm(cdm) and not is_remote_cdm(cdm)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("device", "drm_type"), [({"type": "PLAYREADY", "name": "pr"}, "PlayReady"), ({"name": "wv"}, "Widevine")]
|
||||
)
|
||||
def test_the_load_log_names_a_custom_remote_cdm_by_its_system(device, drm_type):
|
||||
from unshackle.core.cdm.custom_remote_cdm import CustomRemoteCDM
|
||||
|
||||
summary = cdm_summary(CustomRemoteCDM(host="http://h.invalid", device=device))
|
||||
assert summary["drm_type"] == drm_type
|
||||
assert summary["remote"] is True
|
||||
assert summary["device"] == device["name"]
|
||||
|
||||
Reference in New Issue
Block a user