#!/usr/bin/env python3 import importlib.util, json, tempfile, unittest from pathlib import Path ROOT=Path(__file__).resolve().parents[2] spec=importlib.util.spec_from_file_location('entry',ROOT/'server-tools/persona-compute-pool/entry_service.py'); M=importlib.util.module_from_spec(spec); assert spec.loader; spec.loader.exec_module(M) class EntryServiceTests(unittest.TestCase): def test_mother_node_is_forbidden(self): with tempfile.TemporaryDirectory() as tmp: old=M.STATE; M.STATE=Path(tmp)/'state.json'; M.write_state(M.read_state()); self.assertFalse('JD-FD-PRIMARY' in M.read_state()['workers']); M.STATE=old def test_state_has_authority_false(self): value=M.read_state(); self.assertFalse(value['authority_granted']) if __name__=='__main__': unittest.main()