This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Phase-1.0BF live-adapter boundary tests."""
|
||||
|
||||
import argparse, hashlib, json
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--root", type=Path, required=True)
|
||||
root = parser.parse_args().root
|
||||
|
||||
|
||||
class Phase10BFGuardrails(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bf-live-sdl-adapter-boundary-audit.json").read_text(encoding="utf-8"))
|
||||
|
||||
def test_parent_binding(self) -> None:
|
||||
parent = root / "manifests/retroarch/phase-1.0be-fake-only-sdl-materializer.json"
|
||||
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(),
|
||||
self.data["source_bindings"]["phase10be_manifest_sha256"])
|
||||
|
||||
def test_adapter_contract_is_fail_closed(self) -> None:
|
||||
contract = self.data["adapter_contract"]
|
||||
for key, value in contract.items():
|
||||
if key in ("automatic_retry", "automatic_cleanup", "network_capability",
|
||||
"retroarch_build_capability", "device_capability"):
|
||||
self.assertFalse(value, key)
|
||||
else:
|
||||
self.assertTrue(value, key)
|
||||
|
||||
def test_only_dormant_source_is_open(self) -> None:
|
||||
auth = self.data["authorizations"]
|
||||
self.assertTrue(auth["dormant_live_adapter_source_authorized"])
|
||||
for key, value in auth.items():
|
||||
if key != "dormant_live_adapter_source_authorized":
|
||||
self.assertFalse(value, key)
|
||||
self.assertFalse(self.data["decision"]["tool_install_allowed"])
|
||||
self.assertFalse(self.data["decision"]["materialization_allowed"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(argv=[__file__])
|
||||
Reference in New Issue
Block a user