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:
@@ -18,7 +18,6 @@ from unshackle.core.utilities import (
|
||||
timed_operation,
|
||||
)
|
||||
from unshackle.core.utils.redact import (
|
||||
redact_all,
|
||||
redact_path,
|
||||
redact_secrets,
|
||||
redact_text,
|
||||
@@ -137,12 +136,6 @@ def test_body_numbers_stay_unique_across_threads(debug_log: Path):
|
||||
assert sorted(numbers) == list(range(1, 1601))
|
||||
|
||||
|
||||
def test_log_event_noop_when_disabled():
|
||||
close_debug_logger()
|
||||
assert get_debug_logger() is None
|
||||
log_event("should_not_explode", message="no logger") # must not raise
|
||||
|
||||
|
||||
def test_timed_operation_logs_success_and_duration(debug_log: Path):
|
||||
with timed_operation("work", level="INFO", context={"k": "v"}):
|
||||
pass
|
||||
@@ -164,13 +157,6 @@ def test_timed_operation_logs_error_and_reraises(debug_log: Path):
|
||||
assert e["error"]["type"] == "ValueError"
|
||||
|
||||
|
||||
def test_timed_operation_noop_when_disabled():
|
||||
close_debug_logger()
|
||||
with timed_operation("disabled_block"): # must not raise, must still run body
|
||||
value = 1 + 1
|
||||
assert value == 2
|
||||
|
||||
|
||||
def test_sanitize_redacts_sensitive_key_names(debug_log: Path):
|
||||
dl = get_debug_logger()
|
||||
cleaned = dl.sanitize_data(
|
||||
@@ -318,14 +304,6 @@ def test_redact_path_disabled_by_config(monkeypatch):
|
||||
assert redact_path(full) == "<unshackle>/temp/Audio.mp4"
|
||||
|
||||
|
||||
def test_redact_all_composes_secrets_urls_and_paths():
|
||||
root = str(Path(__import__("unshackle.core.utils.redact", fromlist=["x"]).__file__).resolve().parents[3])
|
||||
out = redact_all(f"dl https://u:p@cdn.x/seg.mp4?token=t into {root}/temp")
|
||||
assert "cdn.x" not in out
|
||||
assert "redacted.mp4" in out
|
||||
assert "<unshackle>/temp" in out
|
||||
|
||||
|
||||
def test_redact_secrets_keeps_the_url_but_drops_credentials_and_paths():
|
||||
root = str(Path(__import__("unshackle.core.utils.redact", fromlist=["x"]).__file__).resolve().parents[3])
|
||||
out = redact_secrets(f"404 Not Found: https://u:p@cdn.x/a/b.mpd?token=t (cwd {root}/temp)")
|
||||
@@ -353,12 +331,6 @@ def test_log_drm_operation_accepts_message_and_level_override(debug_log: Path):
|
||||
assert e["drm_type"] == "Widevine"
|
||||
|
||||
|
||||
def test_log_drm_operation_default_message(debug_log: Path):
|
||||
get_debug_logger().log_drm_operation("PlayReady", "license_response")
|
||||
e = find(read_entries(debug_log), "drm_license_response")
|
||||
assert e["message"] == "PlayReady license_response"
|
||||
|
||||
|
||||
def test_log_vault_query_accepts_message_override(debug_log: Path):
|
||||
get_debug_logger().log_vault_query("local", "get_key", message="hit", key_found=True)
|
||||
e = find(read_entries(debug_log), "vault_get_key")
|
||||
@@ -388,8 +360,3 @@ def test_log_tool_run_failure_is_error(debug_log: Path):
|
||||
e = find(read_entries(debug_log), "tool_run")
|
||||
assert e["level"] == "ERROR"
|
||||
assert "failed" in e["message"]
|
||||
|
||||
|
||||
def test_log_tool_run_noop_when_disabled():
|
||||
close_debug_logger()
|
||||
log_tool_run("ffmpeg", "ffmpeg", 0) # must not raise
|
||||
|
||||
Reference in New Issue
Block a user