Files
violin/tests/test_pentest_docs_task4_checkpoint.py
T

44 lines
1.4 KiB
Python

import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
TEMPLATE = ROOT / "skills/pentest/templates/checkpoint.json"
SCOPING = ROOT / "skills/pentest/playbooks/scoping.md"
SKILL = ROOT / "skills/pentest/SKILL.md"
def test_checkpoint_template_has_minimal_resume_schema():
data = json.loads(TEMPLATE.read_text(encoding="utf-8"))
assert data["version"] == 1
expected = {
"engagement_id",
"eng_dir",
"scope_file",
"phase_current",
"ptt_file",
"history_file",
"hypotheses_file",
"phase_summary_file",
"last_checkpoint",
"open_items",
}
assert expected.issubset(data)
forbidden = ["token", "docker", "zap", "container", "bearer", "api_key", "secret"]
serialized = json.dumps(data).lower()
assert not any(term in serialized for term in forbidden)
def test_scoping_bootstrap_writes_checkpoint_from_template():
text = SCOPING.read_text(encoding="utf-8")
assert "checkpoint.json" in text
assert "skills/pentest/templates/checkpoint.json" in text
assert "$ENG_DIR/state/checkpoint.json" in text
assert "phase_current" in text
def test_skill_drift_guard_mentions_checkpoint_on_phase_change():
text = SKILL.read_text(encoding="utf-8")
assert "checkpoint.json" in text
assert "phase change" in text.lower()
assert "$ENG_DIR/state/checkpoint.json" in text