Spaces:
Running
Running
File size: 805 Bytes
62e653c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | """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)")
|