from __future__ import annotations from pathlib import Path from skylattice.core.intent import load_intent, validate_intent_schema from skylattice.core.planner import build_plan from skylattice.core.policy import run_policies def test_reference_intent_validates_and_plans(): root = Path(__file__).resolve().parents[1] / "blueprint" / "tests" / "reference-customer" # policy needs decisions dir; use reference as customer root intent = load_intent(root) errors = validate_intent_schema(intent) assert errors == [], errors plan = build_plan(intent) assert plan["object_count"] > 0 assert any(c.startswith("database:") for c in plan["creates"]) def test_policy_ok_on_reference(tmp_path: Path): src = Path(__file__).resolve().parents[1] / "blueprint" / "tests" / "reference-customer" / "intent.yaml" (tmp_path / "intent.yaml").write_text(src.read_text(encoding="utf-8"), encoding="utf-8") (tmp_path / "decisions").mkdir() intent = load_intent(tmp_path) result = run_policies(tmp_path, intent) assert result.ok, result.errors