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
-41
View File
@@ -165,17 +165,6 @@ def test_good_wanted_passes_at_submit(wanted: Any) -> None:
assert handlers.wanted_refusal(wanted) is None
def test_a_job_error_hides_the_configured_credential(monkeypatch: pytest.MonkeyPatch) -> None:
from datetime import datetime
from unshackle.core.api.download_manager import DownloadJob, JobStatus
monkeypatch.setattr(handlers.config, "credentials", {"EXAMPLE": {"default": "user:EXAMPLE-pass-123"}})
job = DownloadJob("j1", JobStatus.FAILED, datetime(2026, 1, 1), "EXAMPLE", "t", {})
job.error_message = "login failed with EXAMPLE-pass-123"
assert "EXAMPLE-pass-123" not in job.to_dict(include_full_details=True)["error_message"]
@pytest.mark.parametrize(
"configured, secret",
[
@@ -244,19 +233,6 @@ def test_a_relayed_login_prompt_loses_its_control_characters() -> None:
assert asked == [("Code[2J:\n", None)]
def test_a_relayed_qr_code_too_long_to_draw_still_logs_its_line(monkeypatch) -> None:
from unshackle.core import console
seen: list[str] = []
service = RemoteService.__new__(RemoteService)
service._input_bridge, service.auth_qr = None, None
service.log = SimpleNamespace(log=lambda level, message: seen.append(message))
monkeypatch.setattr(console.console, "print", lambda *a, **k: pytest.fail("nothing to draw"))
messages = ServerMessages(service)
messages.show_logs([{"seq": 1, "level": "INFO", "message": "Scan", "qr": "\u20ac" * 1500}])
assert seen == ["Scan"] and messages.log_seq == 1
async def feed(channel: WebSocketChannel, *messages: dict[str, Any]) -> None:
"""Read the given messages on the session channel, then end."""
@@ -274,15 +250,6 @@ def channel_logging_to(seen: list[str]) -> WebSocketChannel:
return WebSocketChannel(messages)
@pytest.mark.parametrize("seq", ["x", "2", None, [1], {"a": 1}, float("inf")])
async def test_a_log_record_with_a_malformed_seq_is_skipped(seq: Any) -> None:
seen: list[str] = []
channel = channel_logging_to(seen)
await feed(channel, {"type": "log", "seq": seq, "message": "bad"}, {"type": "log", "seq": 1, "message": "good"})
assert seen == ["good"]
assert channel.messages.log_seq == 1
async def test_relayed_server_logs_lose_their_control_characters() -> None:
seen: list[str] = []
await feed(channel_logging_to(seen), {"type": "log", "seq": 1, "level": "INFO", "message": "a\x1b[2Jb\nc"})
@@ -314,11 +281,3 @@ def test_a_relayed_licence_with_no_licence_is_one_click_error(answer: dict[str,
track = SimpleNamespace(id="v1", drm=[])
with pytest.raises(click.ClickException, match="no valid licence for track v1"):
service.proxy_license(b"challenge", cast(Any, track), "widevine")
@pytest.mark.parametrize("chapters", [[{"name": "x"}], [{"timestamp": "not a time"}], [5]])
def test_malformed_chapters_from_the_server_are_one_remote_error(chapters: list[Any]) -> None:
service = RemoteService.__new__(RemoteService)
service._chapters_by_title = {"t": chapters}
with pytest.raises(RemoteError, match="malformed chapters"):
service.get_chapters(cast(Any, SimpleNamespace(id="t")))