test_cli_check_ok.py python
55 lines 1.8 KB
Raw
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 1 day ago
1 """Integration — ``ok check-ok`` scaffolds then delegates to review --freeze."""
2
3 from __future__ import annotations
4
5 from datetime import date
6 from pathlib import Path
7
8 from cli.kit_root import kit_root
9 from tests.support import git_status_runner, pass_provider_factory, run_cli, write_config
10 from tools.check_ok.scaffold import scaffold_side_check
11
12
13 def test_scaffold_only_creates_artifact(tmp_path: Path) -> None:
14 write_config(tmp_path, "config-git-only.yaml")
15 code = run_cli(
16 ["check-ok", "--topic", "integration-spike", "--scaffold-only"],
17 cwd=tmp_path,
18 runner=git_status_runner(),
19 kit=kit_root(),
20 )
21 assert code == 0
22 reviews = list((tmp_path / "docs" / "reviews").glob("*-integration-spike.md"))
23 assert len(reviews) == 1
24 assert "frozen: true" in reviews[0].read_text(encoding="utf-8")
25
26
27 def test_check_ok_runs_same_review_engine(tmp_path: Path) -> None:
28 write_config(tmp_path, "config-git-only.yaml")
29 result = scaffold_side_check(
30 tmp_path,
31 topic="wired",
32 scope="Integration scope with seven-tier test matrix and file+line citations.",
33 today=date(2026, 7, 17),
34 )
35 code = run_cli(
36 ["check-ok", "--path", result.rel_path, "--dry-run", "--json"],
37 cwd=tmp_path,
38 runner=git_status_runner(),
39 kit=kit_root(),
40 review_provider_factory=pass_provider_factory(),
41 json_mode=True,
42 )
43 # Local checklist may still emit findings; engine must run (not usage/refuse-init).
44 assert code in {0, 7, 8}
45
46
47 def test_path_escape_refused(tmp_path: Path) -> None:
48 write_config(tmp_path, "config-git-only.yaml")
49 code = run_cli(
50 ["check-ok", "--path", "../outside.md", "--scaffold-only"],
51 cwd=tmp_path,
52 runner=git_status_runner(),
53 kit=kit_root(),
54 )
55 assert code == 4
File History 1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1 docs: MuseHub-first before ISR #74 — staging solidify NEXT Human 1 day ago