test_q2_ok_cli_e2e.py python
54 lines 1.6 KB
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 23 hours ago
1 """E2E 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 tests.support import FIXTURES, run_shim, seed_git_repo
9
10
11 def test_ok_shim_fail_closed_remediation_then_status_and_review_dry_run(tmp_path: Path) -> None:
12 seed_git_repo(tmp_path)
13 review = run_shim(
14 "ok",
15 ["review", "--freeze", "docs/FREEZE.md", "--dry-run"],
16 cwd=tmp_path,
17 )
18 assert review.exit_code == 2
19 assert "run ok init first" in review.stderr
20
21 artifact = tmp_path / "docs" / "FREEZE.md"
22 artifact.parent.mkdir(parents=True, exist_ok=True)
23 artifact.write_text((FIXTURES / "freeze-artifact.md").read_text(encoding="utf-8"), encoding="utf-8")
24
25 review_fail = run_shim(
26 "ok",
27 ["review", "--freeze", "docs/FREEZE.md", "--dry-run"],
28 cwd=tmp_path,
29 )
30 assert review_fail.exit_code == 2
31 assert "run ok init first" in review_fail.stderr
32
33 status = run_shim("ok", ["status"], cwd=tmp_path)
34 assert status.exit_code == 0
35 assert "not initialized" in status.stdout
36
37 init = run_shim(
38 "ok",
39 ["init", "--regime", "git-only", "--non-interactive"],
40 cwd=tmp_path,
41 )
42 assert init.exit_code == 0
43
44 status_json = run_shim("ok", ["status", "--json"], cwd=tmp_path)
45 assert status_json.exit_code == 0
46 payload = json.loads(status_json.stdout)
47 assert payload["initialized"] is True
48
49 review = run_shim(
50 "ok",
51 ["review", "--freeze", "docs/FREEZE.md", "--dry-run"],
52 cwd=tmp_path,
53 )
54 assert review.exit_code in {0, 7, 8}
File History 1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 23 hours ago