Complete 3axis tutorial native and Web/WASM parity tools
This commit is contained in:
32
scripts/test_release_verification.py
Normal file
32
scripts/test_release_verification.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Contract tests for selected-case release verification evidence."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
REPORT = ROOT / "coverage/release-verification.report.json"
|
||||
|
||||
|
||||
class ReleaseVerificationTests(unittest.TestCase):
|
||||
def test_all_required_commands_passed(self) -> None:
|
||||
report = json.loads(REPORT.read_text(encoding="utf-8"))
|
||||
self.assertEqual(report["schema"], "release-verification.v1")
|
||||
self.assertEqual(report["status"], "verified")
|
||||
self.assertEqual(report["release_action"], "ALLOW_RELEASE")
|
||||
self.assertEqual(report["passed_command_count"], report["required_command_count"])
|
||||
self.assertTrue(all(item["status"] == "passed" for item in report["commands"]))
|
||||
|
||||
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(json.dumps(unsigned, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode("utf-8")).hexdigest())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user