test_q2_ok_cli_integrity.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
3 days ago
| 1 | """Data-integrity tests for Track Q / Q2b OK CLI entrypoint (§Q2A.10).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import json |
| 6 | from pathlib import Path |
| 7 | |
| 8 | from cli.footprint import resolve_footprint |
| 9 | from tests.support import load_fixture_config, run_cli, run_shim, seed_git_repo, write_config |
| 10 | |
| 11 | |
| 12 | def test_ok_status_json_is_idempotent(tmp_path: Path) -> None: |
| 13 | seed_git_repo(tmp_path) |
| 14 | write_config(tmp_path, "config-git-only.yaml") |
| 15 | run_cli(["init", "--regime", "git-only", "--non-interactive", "--force"], cwd=tmp_path) |
| 16 | |
| 17 | first = run_shim("ok", ["status", "--json"], cwd=tmp_path) |
| 18 | second = run_shim("ok", ["status", "--json"], cwd=tmp_path) |
| 19 | assert first.exit_code == second.exit_code == 0 |
| 20 | first_payload = json.loads(first.stdout) |
| 21 | second_payload = json.loads(second.stdout) |
| 22 | for key in ("initialized", "kit_version", "lock"): |
| 23 | assert first_payload.get(key) == second_payload.get(key) |
| 24 | |
| 25 | |
| 26 | def test_shims_are_not_footprint_members(tmp_path: Path) -> None: |
| 27 | config = load_fixture_config(tmp_path, "config-git-only.yaml") |
| 28 | destinations = {item.destination for item in resolve_footprint(config)} |
| 29 | assert "cli/ok" not in destinations |
| 30 | assert "cli/overseer" not in destinations |
| 31 | |
| 32 | |
| 33 | def test_version_lock_never_lists_shim_paths(tmp_path: Path) -> None: |
| 34 | seed_git_repo(tmp_path) |
| 35 | write_config(tmp_path, "config-git-only.yaml") |
| 36 | run_cli(["init", "--regime", "git-only", "--non-interactive", "--force"], cwd=tmp_path) |
| 37 | lock_path = tmp_path / ".overseer" / "version.lock" |
| 38 | lock_text = lock_path.read_text(encoding="utf-8") |
| 39 | assert "cli/ok" not in lock_text |
| 40 | assert "cli/overseer" not in lock_text |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
3 days ago