CodeTribunal / tests /test_pdf_export.py
amine-yagoub's picture
test: add export pdf functionality tests
62e653c
raw
history blame contribute delete
805 Bytes
"""Test PDF export from the UI exports module."""
from code_tribunal.ui.exports import export_pdf
def test_export_pdf_generates_file():
"""export_pdf should produce a non-empty PDF file from a context dict."""
ctx = {
"evidence": "## Evidence\n\n- Finding 1: hardcoded password in config.py:42",
"verdict": "## Verdict\n\nOverall: GUILTY\nRisk Score: 78/100",
"report": "## Final Report\n\nExecutive Summary: Code contains critical security vulnerabilities.",
}
pdf_path = export_pdf(ctx)
from pathlib import Path
assert Path(pdf_path).exists(), f"PDF not created at {pdf_path}"
size = Path(pdf_path).stat().st_size
assert size > 500, f"PDF is too small ({size} bytes), likely broken"
print(f"\nPDF generated: {pdf_path} ({size:,} bytes)")