perf: cache media manifest revisions
This commit is contained in:
@@ -32,3 +32,19 @@ def test_media_catalog_does_not_infer_official_source_from_url_substrings(tmp_pa
|
||||
|
||||
assert rows["e" * 64]["source_system"] == "unknown"
|
||||
assert rows["f" * 64]["source_system"] == "rf4db"
|
||||
|
||||
|
||||
def test_media_manifest_cache_invalidates_after_revision(tmp_path, monkeypatch) -> None:
|
||||
manifest_path = tmp_path / "manifest.json"
|
||||
manifest_path.write_text(json.dumps({"version": 1, "assets": [
|
||||
{"status": "approved", "sha256": "a" * 64, "local_path": "one.webp", "entity_type": "fish", "entity_key": "pike"},
|
||||
]}), encoding="utf-8")
|
||||
monkeypatch.setattr(media_catalog, "MEDIA_ROOT", tmp_path)
|
||||
assert [row["id"] for row in media_catalog.published_assets()] == ["a" * 64]
|
||||
|
||||
manifest_path.write_text(json.dumps({"version": 2, "assets": [
|
||||
{"status": "approved", "sha256": "b" * 64, "local_path": "two.webp", "entity_type": "fish", "entity_key": "pike"},
|
||||
]}), encoding="utf-8")
|
||||
|
||||
assert media_catalog.media_manifest_version() == 2
|
||||
assert [row["id"] for row in media_catalog.published_assets()] == ["b" * 64]
|
||||
|
||||
Reference in New Issue
Block a user