test_landing_k12.py
python
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439
feat: K1-P1 complete — agent provenance, build-verification…
Sonnet 4.6
patch
55 days ago
| 1 | """Unit tests for K12 landing manifest and validator helpers.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from pathlib import Path |
| 6 | |
| 7 | import pytest |
| 8 | import yaml |
| 9 | |
| 10 | from tools.landing.schema import load_manifest |
| 11 | from tools.landing.validate import validate_landing |
| 12 | |
| 13 | KIT_ROOT = Path(__file__).resolve().parents[2] |
| 14 | MANIFEST = KIT_ROOT / "docs" / "landing" / "manifest.yaml" |
| 15 | |
| 16 | |
| 17 | def test_manifest_loads_version_one() -> None: |
| 18 | manifest = load_manifest(MANIFEST) |
| 19 | assert manifest.version == 1 |
| 20 | assert manifest.license == "Apache-2.0" |
| 21 | |
| 22 | |
| 23 | def test_manifest_section_ids_match_contract() -> None: |
| 24 | manifest = load_manifest(MANIFEST) |
| 25 | assert manifest.section_ids[0] == "hero" |
| 26 | assert "funnel" in manifest.section_ids |
| 27 | assert len(manifest.section_ids) == 12 |
| 28 | |
| 29 | |
| 30 | def test_manifest_persona_ids_a_through_e() -> None: |
| 31 | manifest = load_manifest(MANIFEST) |
| 32 | assert manifest.persona_ids == ("A", "B", "C", "D", "E") |
| 33 | |
| 34 | |
| 35 | def test_manifest_status_badges_frozen_enum() -> None: |
| 36 | manifest = load_manifest(MANIFEST) |
| 37 | assert manifest.status_badges == frozenset({"dogfood", "reference", "aspirational"}) |
| 38 | |
| 39 | |
| 40 | def test_manifest_rejects_bad_version(tmp_path: Path) -> None: |
| 41 | bad = tmp_path / "manifest.yaml" |
| 42 | bad.write_text(yaml.dump({"version": 99, "license": "Apache-2.0"}), encoding="utf-8") |
| 43 | with pytest.raises(ValueError, match="unsupported manifest version"): |
| 44 | load_manifest(bad) |
| 45 | |
| 46 | |
| 47 | def test_license_file_references_apache() -> None: |
| 48 | text = (KIT_ROOT / "LICENSE").read_text(encoding="utf-8") |
| 49 | assert "Apache License" in text |
| 50 | assert "Version 2.0" in text |
| 51 | |
| 52 | |
| 53 | def test_validate_missing_manifest_fails(tmp_path: Path) -> None: |
| 54 | result = validate_landing(tmp_path) |
| 55 | assert not result.ok |
| 56 | assert any(e.startswith("manifest_parse:") for e in result.errors) |
File History
1 commit
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439
feat: K1-P1 complete — agent provenance, build-verification…
Sonnet 4.6
patch
55 days ago