test: replace real service tags and brands with generic placeholders

This commit is contained in:
imSp4rky
2026-10-18 12:17:08 -06:00
parent 768e35d905
commit 6fdfeb9cae
12 changed files with 48 additions and 45 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ from unshackle.core.api.handlers import load_client_cookies
COOKIE_FILE = "\n".join(
[
"# Netscape HTTP Cookie File",
"\t".join([".primevideo.com", "TRUE", "/", "TRUE", "2000000000", "session-id", "123-456"]),
"\t".join([".example.com", "TRUE", "/", "TRUE", "2000000000", "session-id", "123-456"]),
"",
]
)
+2 -2
View File
@@ -15,7 +15,7 @@ dl:
a_lang: [yes]
require_subs: no
require_audio: [no]
AMZN:
EXAMPLE:
lang: no
muxing:
default_language:
@@ -43,7 +43,7 @@ def test_bool_shaped_tags_survive_every_language_key(tmp_path: Path) -> None:
assert config.dl["a_lang"] == ["yes"]
assert config.dl["require_subs"] == "no"
assert config.dl["require_audio"] == ["no"]
assert config.dl["AMZN"]["lang"] == "no"
assert config.dl["EXAMPLE"]["lang"] == "no"
assert config.muxing["default_language"]["audio"] == "no"
assert config.audio["language_priority"] == ["no", "da"]
+1 -1
View File
@@ -38,7 +38,7 @@ def test_safe_cache_key_accepts_plain_filename():
def test_safe_cache_key_accepts_nested_key_and_normalises_separators():
# A Cacher key with a subdirectory, as NF uses ("session_web/<sha1>"), keeps its
# A Cacher key with a subdirectory ("session_web/<sha1>") keeps its
# posix form; a backslash from a Windows peer names the same nested file.
assert safe_cache_key("session_web/abc") == "session_web/abc"
assert safe_cache_key("MSL/a/b") == "MSL/a/b"
+2 -2
View File
@@ -228,14 +228,14 @@ def test_refresh_reports_discarded_local_edits(monkeypatch, tmp_path):
def run(args, **kw):
if "diff" in args and "--name-only" in args:
return subprocess.CompletedProcess(args, 0, b"CR/__init__.py\n", b"") # local edit present
return subprocess.CompletedProcess(args, 0, b"EXAMPLE/__init__.py\n", b"") # local edit present
if "rev-parse" in args:
return subprocess.CompletedProcess(args, 0, b"samehead\n", b"") # upstream did not advance
return subprocess.CompletedProcess(args, 0, b"", b"") # fetch/reset/diff
monkeypatch.setattr(service_repo.subprocess, "run", run)
_, changes = service_repo.refresh_repo("a/b")
assert changes == ["!CR"]
assert changes == ["!EXAMPLE"]
def test_changed_services_up_to_date(monkeypatch):
+3 -4
View File
@@ -43,8 +43,7 @@ def sent_timeout(adapter: HTTPAdapter) -> Any:
def test_subclass_adapter_keeps_its_class_and_tls_context() -> None:
"""A service-mounted SSLCiphers must survive the growth with its TLS context.
CBS, friDay, iP, MY5 and PMTP all mount SSLCiphers on the service session and none
override get_session(). Replacing it with a plain adapter drops DEFAULT:@SECLEVEL=2 and
Services mount SSLCiphers on the service session without overriding get_session(). Replacing it with a plain adapter drops DEFAULT:@SECLEVEL=2 and
check_hostname=False, so metadata succeeds and every segment then fails at TLS or 403.
"""
session = requests.Session()
@@ -75,13 +74,13 @@ def test_a_distinct_http_adapter_is_grown_not_overwritten() -> None:
narrow = SSLCiphers(security_level=2)
plain = TimeoutHTTPAdapter(pool_connections=10, pool_maxsize=10)
session.mount("https://", secure)
session.mount("https://cbs.example/", narrow)
session.mount("https://svc.example/", narrow)
session.mount("http://", plain)
grow_session_pool(session, 64)
assert session.get_adapter("https://x") is secure
assert session.get_adapter("https://cbs.example/a") is narrow
assert session.get_adapter("https://svc.example/a") is narrow
assert session.get_adapter("http://x") is plain
assert session.get_adapter("http://x") is not session.get_adapter("https://x")
for adapter in (secure, narrow, plain):
+1 -1
View File
@@ -390,7 +390,7 @@ def test_only_the_kid_whose_window_fails_is_flagged(tmp_path: Path, monkeypatch:
lead = UUID(int=7)
local = SQLite("local", tmp_path / "local.db")
poisoned = Remote("poisoned", tmp_path / "poisoned.db")
poisoned.add_key("SVC", lead, BAD) # the same wrong key under both KIDs, as the NF title had
poisoned.add_key("SVC", lead, BAD) # the same wrong key under both KIDs
poisoned.add_key("SVC", KID, BAD)
other = Remote("other", tmp_path / "other.db")
other.add_key("SVC", KID, GOOD)