18 lines
1.6 KiB
Python
18 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
import argparse,hashlib,json,unittest
|
|
from pathlib import Path
|
|
parser=argparse.ArgumentParser();parser.add_argument("--root",type=Path,required=True);root=parser.parse_args().root
|
|
class Phase10CZGuardrails(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.m=json.loads((root/"manifests/retroarch/phase-1.0cz-launch-canary-one-shot-runner.json").read_text());cls.a=json.loads((root/"manifests/retroarch/phase-1.0cz-one-shot-approval-template.json").read_text())
|
|
def test_inactive_gate(self):
|
|
p=root/"manifests/retroarch/phase-1.0cy-launch-canary-reproducibility-result.json";self.assertEqual(hashlib.sha256(p.read_bytes()).hexdigest(),self.m["source_bindings"]["phase10cy_manifest_sha256"])
|
|
p=self.m["result_protocol"];self.assertEqual(p["wire_stages"][-1],"D14");self.assertEqual(p["sole_terminal"],"D14");self.assertEqual(p["required_order"],["D07","D04","D14"]);self.assertFalse(p["post_terminal_bytes_allowed"])
|
|
self.assertFalse(self.m["artifact"]["execution_eligible"] or self.m["artifact"]["transfer_eligible"]);self.assertIsNone(self.m["route"]["target"]);self.assertIsNone(self.m["route"]["port"]);self.assertIsNone(self.m["runner"]["run_id"])
|
|
for value in self.m["authorizations"].values():self.assertFalse(value)
|
|
def test_approval_template_inactive(self):
|
|
self.assertFalse(self.a["authorized"] or self.a["consumed"]);self.assertIsNone(self.a["authorized_by"]);self.assertIsNone(self.a["target"]);self.assertIsNone(self.a["port"]);self.assertIsNone(self.a["run_id"]);self.assertEqual(self.a["connection_count"],0)
|
|
if __name__=="__main__":unittest.main(argv=[__file__])
|