Implement AXIS parity UI and execution baseline
This commit is contained in:
48
scripts/test_authoritative_browser_s6_05.py
Normal file
48
scripts/test_authoritative_browser_s6_05.py
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Contract tests for S6-05 OPFS/browser boundary evidence."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
import generate_authoritative_browser_s6_05
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
REPORT = ROOT / "coverage/authoritative-browser-s6-05.report.json"
|
||||
|
||||
|
||||
class AuthoritativeBrowserS605Tests(unittest.TestCase):
|
||||
def test_contract(self) -> None:
|
||||
report = json.loads(REPORT.read_text(encoding="utf-8"))
|
||||
self.assertEqual(report["schema"], "authoritative-browser-s6-05.v1")
|
||||
self.assertEqual(report["task_id"], "S6-05")
|
||||
self.assertEqual(report["status"], "verified")
|
||||
self.assertEqual(report["implementation_status"], "verified")
|
||||
self.assertEqual(report["checks"]["chromium_probe"]["status"], "blocked")
|
||||
self.assertTrue(report["checks"]["chromium_probe"]["stable"])
|
||||
self.assertEqual(report["checks"]["headed_playwright_probe"]["status"], "verified")
|
||||
self.assertTrue(report["checks"]["headed_playwright_probe"]["stable"])
|
||||
self.assertEqual(report["checks"]["safari_firefox_boundary"]["status"], "out_of_scope")
|
||||
self.assertEqual(report["checks"]["release_stop"]["action"], "STOP_RELEASE")
|
||||
|
||||
def test_self_hash(self) -> None:
|
||||
report = json.loads(REPORT.read_text(encoding="utf-8"))
|
||||
unsigned = {key: value for key, value in report.items() if key != "report_sha256"}
|
||||
self.assertEqual(report["report_sha256"], hashlib.sha256(generate_authoritative_browser_s6_05.canonical(unsigned).encode()).hexdigest())
|
||||
|
||||
def test_deterministic(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
first = generate_authoritative_browser_s6_05.generate(ROOT, Path(directory) / "one.json")
|
||||
second = generate_authoritative_browser_s6_05.generate(ROOT, Path(directory) / "two.json")
|
||||
self.assertEqual(first, second)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user