fix: make media provenance explicit
CI / backend-and-migrations (push) Failing after 38s
CI / astro-build (push) Failing after 39s
CI / dependency-audit (push) Failing after 46s
CI / compose-e2e (push) Failing after 41s

This commit is contained in:
ik
2026-09-22 20:02:40 +07:00
parent 1920475580
commit a357988f93
4 changed files with 36 additions and 4 deletions
+14
View File
@@ -18,3 +18,17 @@ def test_public_media_catalog_rejects_unknown_and_cross_entity_roles(tmp_path, m
rows = media_catalog.published_assets()
assert [row["id"] for row in rows] == ["d" * 64, "a" * 64]
def test_media_catalog_does_not_infer_official_source_from_url_substrings(tmp_path, monkeypatch) -> None:
manifest = {"assets": [
{"status": "approved", "sha256": "e" * 64, "local_path": "asset.webp", "entity_type": "fish", "entity_key": "pike", "source_page": "https://rf4db.com.attacker.test/pike"},
{"status": "approved", "sha256": "f" * 64, "local_path": "asset2.webp", "entity_type": "fish", "entity_key": "pike", "source_page": "https://rf4db.com/ru/fish/pike"},
]}
(tmp_path / "manifest.json").write_text(json.dumps(manifest), encoding="utf-8")
monkeypatch.setattr(media_catalog, "MEDIA_ROOT", tmp_path)
rows = {row["id"]: row for row in media_catalog.published_assets()}
assert rows["e" * 64]["source_system"] == "unknown"
assert rows["f" * 64]["source_system"] == "rf4db"