17 lines
1.3 KiB
Python
17 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
from __future__ import annotations
|
|
import argparse,json,unittest
|
|
from pathlib import Path
|
|
P=argparse.ArgumentParser();P.add_argument("--root",type=Path,required=True);R=P.parse_args().root
|
|
class Tests(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):cls.m=json.loads((R/"manifests/retroarch/phase-1.0dn-inactive-snapshot-receiver.json").read_text())
|
|
def test_inactive(self):self.assertFalse(self.m["activation"]["active"]);self.assertTrue(all(v is None for k,v in self.m["activation"].items() if k!="active"))
|
|
def test_receiver(self):
|
|
r=self.m["receiver"];self.assertFalse(r["network_import_present"] or r["partial_is_success"] or r["overwrite_allowed"]);self.assertTrue(r["exclusive_output"] and r["incremental_sha256"] and r["exact_terminal_required"] and r["fsync_before_success"])
|
|
def test_artifact_ineligible(self):self.assertFalse(self.m["artifact"]["execution_eligible"] or self.m["artifact"]["transfer_eligible"])
|
|
def test_no_authority(self):self.assertFalse(any(self.m["authorizations"].values()) or self.m["decision"]["live_adapter_allowed"] or self.m["decision"]["device_action_allowed"])
|
|
def test_next(self):self.assertEqual(self.m["decision"]["next_step"],"INACTIVE_EXACT_ARTIFACT_ONE_SHOT_LIVE_RUNNER")
|
|
if __name__=="__main__":unittest.main(argv=[__file__])
|