41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
import json
|
|
|
|
from typer.testing import CliRunner
|
|
|
|
from tht.cli import app
|
|
|
|
|
|
def test_evidence_authoring_commands_are_distinct_from_runtime_preprocessing():
|
|
result = CliRunner().invoke(app, ["evidence", "--help"])
|
|
|
|
assert result.exit_code == 0
|
|
assert "prepare" in result.output
|
|
assert "validate" in result.output
|
|
|
|
|
|
def test_evidence_validate_json_is_pristine_and_reports_review_required(monkeypatch, tmp_path):
|
|
from tht.cli import evidence_cmd
|
|
from tht.evidence import ValidationFinding, ValidationReport
|
|
|
|
monkeypatch.setattr(evidence_cmd, "_canonical_worktree", lambda root: root)
|
|
monkeypatch.setattr(evidence_cmd, "validate_workspace_evidence", lambda root: ValidationReport((
|
|
ValidationFinding("error", "unresolved_review_item", "curated/domain/x.md", "Review needed."),
|
|
)))
|
|
|
|
result = CliRunner().invoke(app, ["evidence", "validate", str(tmp_path), "--json"])
|
|
|
|
assert result.exit_code == 3
|
|
assert result.stderr == ""
|
|
assert json.loads(result.stdout) == {
|
|
"findings": [{
|
|
"code": "unresolved_review_item",
|
|
"message": "Review needed.",
|
|
"path": "curated/domain/x.md",
|
|
"severity": "error",
|
|
}],
|
|
"operation": "evidence_validate",
|
|
"publishable": False,
|
|
"schemaVersion": 1,
|
|
"status": "review_required",
|
|
}
|