Files
Agentic-AI-Template/Document/scripts/test_validate_workspace.py
T
2026-04-24 08:34:53 +09:00

46 lines
1.5 KiB
Python

"""validate_workspace.py Report Harness tests."""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
import validate_workspace as vw
def write_required_docs(root: Path):
docs = root / "docs"
docs.mkdir()
contents = {
"PRD.md": "# Brief\n\n## 보고서 주제\n\n## 용도\n\n## 핵심 키워드\n\n## 방향성\n",
"ARCHITECTURE.md": "# Architecture\n",
"ADR.md": "# ADR\n",
"UI_GUIDE.md": "# Style\n",
"RESEARCH_LOG.md": "# Research\n\n## 출처 목록\n\n## 검증 필요\n",
"REPORT_DRAFT.md": "# Draft\n\n## Executive Summary\n\n## 참고 출처\n\n## 사용자 피드백 질문\n",
"FEEDBACK.md": "# Feedback\n\n## 다음 반복에서 확인할 사항\n",
}
for filename, text in contents.items():
(docs / filename).write_text(text, encoding="utf-8")
def test_validate_report_docs_success(tmp_path):
write_required_docs(tmp_path)
assert vw.validate_report_docs(tmp_path) == []
def test_validate_report_docs_reports_missing_doc(tmp_path):
write_required_docs(tmp_path)
(tmp_path / "docs" / "RESEARCH_LOG.md").unlink()
assert "Missing docs/RESEARCH_LOG.md." in vw.validate_report_docs(tmp_path)
def test_validate_report_docs_reports_missing_section(tmp_path):
write_required_docs(tmp_path)
(tmp_path / "docs" / "PRD.md").write_text("# Brief\n\n## 보고서 주제\n", encoding="utf-8")
errors = vw.validate_report_docs(tmp_path)
assert "docs/PRD.md missing section: ## 용도" in errors