"""Ordinary release plans cannot reinstall the retired EXP approval copy.""" import importlib.util import json from pathlib import Path import sys import unittest ROOT = Path(__file__).resolve().parents[1] class ApprovalConfigurationPreservationTest(unittest.TestCase): def test_deployment_has_no_quote_approval_seed_owner(self): catalog = json.loads((ROOT / "deployments/offline/runtime/seeds/deploy-seed-catalog.json").read_text()) self.assertNotIn("quote_approval_seed", catalog["modules"]) for profile in catalog["profiles"].values(): for invocation in profile["invocations"]: self.assertNotEqual(invocation["module_id"], "quote_approval_seed") for path in ("scripts/apply_quote_approval_seed_adapter.py", "deployments/offline/runtime/apply_exp_quote_approval_seed.py", "deployments/offline/runtime/seeds/exp-quote-approvals.seed.json"): self.assertFalse((ROOT / path).exists(), path) def test_retained_wrapper_repair_keeps_its_exact_semantic_hashes(self): path = ROOT / "deployments/offline/runtime/reconcile/reconcile_quote_approval_action_wrappers.py" spec = importlib.util.spec_from_file_location("approval_wrapper_reference_test", path) module = importlib.util.module_from_spec(spec) sys.modules[spec.name] = module try: spec.loader.exec_module(module) authority = module.load_authority(ROOT) self.assertEqual(len(authority.targets), 4) reference = json.loads(authority.source_path.read_text()) self.assertEqual(set(reference), {"processDefinitions"}) for definition in reference["processDefinitions"]: self.assertEqual(set(definition), {"developerName", "metadataBase64"}) finally: sys.modules.pop(spec.name, None)