import importlib.util from pathlib import Path import unittest s=importlib.util.spec_from_file_location('ownership',Path(__file__).with_name('editorial-ownership.py')) m=importlib.util.module_from_spec(s);s.loader.exec_module(m) class RuntimeStateTests(unittest.TestCase): def test_installed_runner_evidence_is_reviewed_but_arbitrary_state_is_not(self): prefix='editorial-v4/runner-state/' good='1a00bc08-3ca4-4519-ae1e-9eec7b098756-efcc15cd7b824198abc4f85abcfb0730-canina-competitor-worker.json' self.assertTrue(m.allowed(prefix+good,False)) for name in ['anything.json',good.replace('canina-competitor-worker','unreviewed'),good+'/nested',good.replace('efcc15cd7b824198abc4f85abcfb0730','oops')]: self.assertFalse(m.allowed(prefix+name,False)) self.assertFalse(m.allowed(prefix+good,True))