test_legacy_goldens.py 1.1 KB

12345678910111213141516171819202122232425262728
  1. from __future__ import annotations
  2. import json
  3. import re
  4. from pathlib import Path
  5. def test_checked_in_legacy_capture_manifest_is_complete_and_bounded() -> None:
  6. path = Path(__file__).parent / "fixtures" / "legacy_http_goldens_manifest.json"
  7. manifest = json.loads(path.read_text(encoding="utf-8"))
  8. assert manifest["schema_version"] == "legacy-http-golden-manifest/v1"
  9. assert manifest["host_baseline_commit"] == "1495d063"
  10. assert manifest["legacy_source"]["source_commit"]
  11. assert manifest["redaction"]["rules"]
  12. captures = manifest["captures"]
  13. assert {item["name"] for item in captures} == {"run-454-detail", "run-454-log"}
  14. for capture in captures:
  15. assert capture["method"] == "GET"
  16. assert capture["route"].startswith("/api/pattern/script_builds/454")
  17. assert capture["status"] == 200
  18. assert re.fullmatch(r"[0-9a-f]{64}", capture["sha256"])
  19. assert capture["comparison"] in {
  20. "exact",
  21. "legacy-fields-exact-overlay-declared",
  22. }
  23. assert len(capture["legacy_top_level_fields"]) == len(
  24. set(capture["legacy_top_level_fields"])
  25. )