diff --git a/tests/test_contract.py b/tests/test_contract.py index 02a7b64..7fcb972 100644 --- a/tests/test_contract.py +++ b/tests/test_contract.py @@ -559,15 +559,20 @@ class PublishingTests(unittest.TestCase): second = deploy.previous_route_contracts(app_dir) self.assertEqual(first, second) - def test_removed_artifact_keeps_bucket_access_history(self): + def test_protected_split_bucket_survives_absence_and_blocks_legacy(self): raw = fixture("split-site.yaml") - raw["artifacts"] = [item for item in raw["artifacts"] if item["name"] == "portal"] - raw["routes"] = [item for item in raw["routes"] if item["artifact"] == "portal"] + raw["artifacts"] = [ + item for item in raw["artifacts"] if item["name"] == "distributions" + ] + raw["routes"] = [ + item for item in raw["routes"] if item["artifact"] == "distributions" + ] + raw["routes"][0]["path"] = "/" cfg = normalize_site_config(raw, "baseline.fritzlab.net") previous = { - "baseline-dist": { - "path": "/dist", "access": "protected", "artifact": "distributions", - "immutable_paths": ["dist/releases"], + "baseline.fritzlab.net": { + "path": "/", "access": "protected", "artifact": "portal", + "immutable_paths": [], } } with tempfile.TemporaryDirectory() as tmp: @@ -576,12 +581,14 @@ class PublishingTests(unittest.TestCase): "baseline.fritzlab.net", ROOT, app_dir, app_dir / "manifests", cfg, previous, ) retained = deploy.previous_route_contracts(app_dir) - self.assertEqual(previous["baseline-dist"], retained["baseline-dist"]) - readded = normalize_site_config( - fixture("split-site.yaml"), "baseline.fritzlab.net", + self.assertEqual( + previous["baseline.fritzlab.net"], retained["baseline.fritzlab.net"], + ) + legacy = normalize_site_config( + fixture("legacy-site.yaml"), "baseline.fritzlab.net", ) with self.assertRaisesRegex(RuntimeError, "cannot become public while reusing protected"): - deploy.validate_route_migrations(readded, retained) + deploy.validate_route_migrations(legacy, retained) def test_malformed_persistent_history_fails_closed(self): with tempfile.TemporaryDirectory() as tmp: