feat(render-mode): Rich (LibreOffice) vs Standard (pandoc) toggle for office formats (.docx/.odt/.rtf); Rich default; 5 office tests; 152/152 green"
Test / Tests (Python 3.12) (push) Canceled after 0s

This commit is contained in:
Amelia
2026-09-04 17:31:26 -04:00
parent 383635c57c
commit 069dab0411
7 changed files with 318 additions and 13 deletions
+16 -7
View File
@@ -219,16 +219,22 @@ def pandoc_fixtures():
# --------------------------------------------------------------------------
def _submit(client, filename, content):
def _submit(client, filename, content, render_mode="standard"):
# AC: docx/odt/rtf are gated by render_mode; standard keeps them on the
# EXISTING pandoc path (no LibreOffice) — this file pins pandoc-family
# behavior, so every call here requests standard explicitly.
if isinstance(content, str):
content = content.encode("utf-8")
files = {"file": (io.BytesIO(content), filename)}
return client.post("/api/convert", data=files, content_type="multipart/form-data")
data = {"file": (io.BytesIO(content), filename), "render_mode": render_mode}
return client.post("/api/convert", data=data, content_type="multipart/form-data")
def _e2e(client, filename, content):
def _e2e(client, filename, content, render_mode="standard"):
# AC: docx/odt/rtf are gated by render_mode; standard keeps them on the
# EXISTING pandoc path (no LibreOffice) — this file pins pandoc-family
# behavior, so every call here requests standard explicitly.
"""Submit, wait for terminal, assert done, return (job, pdf_bytes, pdf_text)."""
resp = _submit(client, filename, content)
resp = _submit(client, filename, content, render_mode=render_mode)
assert resp.status_code == 202, resp.get_json()
job = wait_for_job(client, resp.get_json()["job_id"])
assert job["status"] == "done", job
@@ -237,9 +243,12 @@ def _e2e(client, filename, content):
return job, data, pdf_text(data)
def _error_job(client, filename, content):
def _error_job(client, filename, content, render_mode="standard"):
# AC: docx/odt/rtf are gated by render_mode; standard keeps them on the
# EXISTING pandoc path (no LibreOffice) — this file pins pandoc-family
# behavior, so every call here requests standard explicitly.
"""Submit, expect 202 then a terminal error state; return the snapshot."""
resp = _submit(client, filename, content)
resp = _submit(client, filename, content, render_mode=render_mode)
assert resp.status_code == 202, resp.get_json()
job = wait_for_job(client, resp.get_json()["job_id"])
assert job["status"] == "error", job