forked from kenzuya/unshackle
test: delete slow, timing-based and redundant tests
This commit is contained in:
@@ -11,17 +11,16 @@ from uuid import UUID
|
||||
import click
|
||||
import pytest
|
||||
|
||||
from tests.drm_plugins import EXAMPLE, ExampleDevice
|
||||
from unshackle.commands.dl import cdm_summary
|
||||
from tests.drm_plugins import ExampleDevice
|
||||
from unshackle.core import plugins
|
||||
from unshackle.core.cdm import loader
|
||||
from unshackle.core.cdm.choice import choose_cdm, drm_system
|
||||
from unshackle.core.cdm.detect import cdm_system, cdm_type_stub
|
||||
from unshackle.core.cdm.detect import cdm_system
|
||||
from unshackle.core.drm import ClearKeyCTR, CustomDRM, held_key, own_cipher
|
||||
from unshackle.core.plugins import DrmPlugin, load_folder
|
||||
from unshackle.core.remote_protocol import APIErrorCode
|
||||
from unshackle.core.tracks import Video
|
||||
from unshackle.core.wire import drm_from_dict, export_system
|
||||
from unshackle.core.wire import drm_from_dict
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
@@ -116,10 +115,6 @@ def test_a_second_plugin_with_the_same_id_is_skipped(tmp_path: Path, caplog) ->
|
||||
assert caplog.messages == ["DRM plugin second.zip repeats the id 'example', skipped"]
|
||||
|
||||
|
||||
def test_a_missing_plugin_folder_loads_nothing(tmp_path: Path) -> None:
|
||||
assert load_folder(tmp_path / "absent") == {}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"facts",
|
||||
[{"id": "widevine"}, {"id": "Bad-Id"}, {"licensing": "remote"}, {"mode": "file"}, {"device_suffix": ".exd"}],
|
||||
@@ -166,28 +161,6 @@ def test_a_plugin_device_is_an_entry_of_the_cdm_catalogue(example_plugins: None,
|
||||
assert isinstance(cdm, ExampleDevice) and cdm_system(cdm) == "example"
|
||||
|
||||
|
||||
def test_the_load_log_names_a_plugin_cdm_by_its_label_and_device_name(example_plugins: None, tmp_path: Path) -> None:
|
||||
cdm = ExampleDevice(tmp_path / "EXAMPLE_DEVICE.exd")
|
||||
assert cdm_summary(cdm) == {"drm_type": "EXAMPLE", "remote": False, "device": "EXAMPLE_DEVICE"}
|
||||
del cdm.device_name
|
||||
assert cdm_summary(cdm)["device"] == "EXAMPLE"
|
||||
|
||||
cdm.security_level = "v5"
|
||||
assert cdm_summary(cdm)["security_level"] == "v5"
|
||||
|
||||
|
||||
def test_a_stub_of_a_plugin_system_is_that_system(example_plugins: None) -> None:
|
||||
assert cdm_system(cdm_type_stub("example")) == "example"
|
||||
assert cdm_system(cdm_type_stub("None")) == "widevine"
|
||||
|
||||
|
||||
def test_a_client_with_a_plugin_cdm_is_a_stand_in_of_its_system(example_plugins: None) -> None:
|
||||
from unshackle.core.api.handlers import client_device_cdm
|
||||
|
||||
cdm = client_device_cdm({"cdm_type": "example"}, input_bridge=SimpleNamespace())
|
||||
assert cdm_system(cdm) == "example"
|
||||
|
||||
|
||||
def test_a_plugin_device_licenses_a_plugin_drm(example_plugins: None, tmp_path: Path) -> None:
|
||||
device = tmp_path / "EXAMPLE_DEVICE.exd"
|
||||
device.write_bytes(bytes(range(16)))
|
||||
@@ -236,19 +209,3 @@ def test_the_export_form_of_a_plugin_drm_round_trips_without_its_keys(example_pl
|
||||
{"key": "aa" * 16},
|
||||
{},
|
||||
)
|
||||
|
||||
|
||||
def test_an_export_of_a_plugin_that_is_not_loaded_stops_the_track() -> None:
|
||||
with pytest.raises(click.ClickException, match=r"^Unknown DRM system 'example' in the export$"):
|
||||
export_system("example")
|
||||
|
||||
|
||||
def test_the_registry_loads_the_plugin_folder_once(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
|
||||
plugin_folder(tmp_path, "example_pkg")
|
||||
monkeypatch.setattr(plugins, "PLUGINS", None)
|
||||
from unshackle.core.config import config
|
||||
|
||||
monkeypatch.setattr(config.directories, "plugins", tmp_path)
|
||||
|
||||
assert plugins.get("example") is not None and plugins.get("example") is plugins.plugins()["example"]
|
||||
assert plugins.get(EXAMPLE) is None
|
||||
|
||||
Reference in New Issue
Block a user