Implement AXIS parity UI and execution baseline
This commit is contained in:
38
scripts/test_axis_source_inventory.py
Normal file
38
scripts/test_axis_source_inventory.py
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Contract tests for the AXIS source/asset parity inventory."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import generate_axis_source_inventory
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
REPORT = ROOT / "coverage/axis-source-inventory.report.json"
|
||||
|
||||
|
||||
class AxisSourceInventoryTests(unittest.TestCase):
|
||||
def test_contract(self) -> None:
|
||||
report = json.loads(REPORT.read_text(encoding="utf-8"))
|
||||
self.assertEqual(report["schema"], "axis-source-inventory.v1")
|
||||
self.assertEqual(report["task_id"], "AXIS-INV-01")
|
||||
self.assertEqual(report["status"], "verified")
|
||||
self.assertEqual(len(report["assets"]), 21)
|
||||
self.assertEqual(report["checks"]["toolbar_assets"]["status"], "verified")
|
||||
self.assertEqual(report["checks"]["source_line_count"]["actual"], 2300)
|
||||
self.assertGreaterEqual(report["axis_tcl"]["procedure_count"], 20)
|
||||
self.assertGreaterEqual(report["axis_tcl"]["binding_count"], 10)
|
||||
|
||||
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"}
|
||||
expected = hashlib.sha256(generate_axis_source_inventory.canonical(unsigned).encode("utf-8")).hexdigest()
|
||||
self.assertEqual(report["report_sha256"], expected)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user