This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Phase-1.0BD fail-closed repository tests."""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--root", type=Path, required=True)
|
||||
root = parser.parse_args().root
|
||||
|
||||
|
||||
class Phase10BDGuardrails(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bd-dormant-sdl-materializer-policy.json").read_text(encoding="utf-8"))
|
||||
|
||||
def test_policy_is_dormant(self) -> None:
|
||||
props = self.data["policy_properties"]
|
||||
for key in ("exact_identity_validation", "clean_absent_output_required",
|
||||
"immutable_plan", "exact_three_file_patch_scope"):
|
||||
self.assertTrue(props[key])
|
||||
for key in ("process_adapter_present", "filesystem_adapter_present",
|
||||
"network_present", "cli_present", "retroarch_build_included",
|
||||
"device_action_included"):
|
||||
self.assertFalse(props[key])
|
||||
|
||||
def test_only_injected_adapter_source_is_open(self) -> None:
|
||||
auth = self.data["authorizations"]
|
||||
self.assertTrue(auth["injected_adapter_source_authorized"])
|
||||
for key, value in auth.items():
|
||||
if key != "injected_adapter_source_authorized":
|
||||
self.assertFalse(value, key)
|
||||
self.assertFalse(self.data["decision"]["materialization_allowed"])
|
||||
self.assertFalse(self.data["decision"]["cross_build_allowed"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(argv=[__file__])
|
||||
Reference in New Issue
Block a user