15 lines
1.2 KiB
Python
15 lines
1.2 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 Phase10CSGuardrails(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):cls.data=json.loads((root/"manifests/retroarch/phase-1.0cs-export-parent-correction-gate.json").read_text())
|
|
def test_gate(self):
|
|
p=root/"manifests/retroarch/phase-1.0cr-audited-sdl-archive-export-gate.json";self.assertEqual(hashlib.sha256(p.read_bytes()).hexdigest(),self.data["source_bindings"]["phase10cr_manifest_sha256"])
|
|
c=self.data["consumed_attempt"];self.assertEqual(c["classification"],"REJECTED_BEFORE_DESTINATION_MUTATION");self.assertFalse(c["destination_leaf_created"] or c["retry_performed"])
|
|
a=self.data["authorizations"];self.assertTrue(a["exact_parent_creation_authorized"] and a["archive_export_authorized"])
|
|
for k in ("source_cleanup_authorized","retroarch_target_build_authorized","network_access_authorized","ps5_connection_authorized","device_transfer_authorized","device_execution_authorized"):self.assertFalse(a[k],k)
|
|
if __name__=="__main__":unittest.main(argv=[__file__])
|