Files
linuxcncWebWASM/scripts/test_rs274_s1b_report.py

22 lines
794 B
Python

import hashlib
import json
import unittest
from pathlib import Path
import generate_rs274_s1b_report
ROOT = Path(__file__).resolve().parents[1]
class Rs274S1bTests(unittest.TestCase):
def test_report(self):
report = json.loads((ROOT / "coverage/rs274-s1b.report.json").read_text())
self.assertEqual(report["schema"], "rs274-s1b-report.v1")
self.assertEqual(report["status"], "verified")
self.assertIn("G10 L2 coordinate offsets", report["features"])
def test_hash(self):
report = json.loads((ROOT / "coverage/rs274-s1b.report.json").read_text())
unsigned = dict(report)
actual = unsigned.pop("report_sha256")
self.assertEqual(actual, hashlib.sha256(generate_rs274_s1b_report.canonical(unsigned).encode()).hexdigest())