generated from john/python-template
V4.4 revision to facsimile print format
This commit is contained in:
@@ -4,6 +4,7 @@ import pytest
|
||||
|
||||
from transcription.db import session_scope
|
||||
from transcription.db.models import Document
|
||||
from transcription.db.models import DocumentType
|
||||
from transcription.db.models import Source
|
||||
from transcription.ui.pages.print_preview_page import reflow_transcription
|
||||
|
||||
@@ -26,7 +27,14 @@ async def test_document_print_preview_and_safe_media_route(app_client):
|
||||
pdf_path.write_bytes(b"%PDF-1.4\n%%EOF")
|
||||
|
||||
async with session_scope() as session:
|
||||
document = Document(name="<Print & Preserve>", notes="<script>unsafe()</script>")
|
||||
document_type = DocumentType(label="Photograph", normalized_label="photograph")
|
||||
session.add(document_type)
|
||||
await session.flush()
|
||||
document = Document(
|
||||
name="<Print & Preserve>",
|
||||
notes="<script>unsafe()</script>",
|
||||
document_type_id=document_type.id,
|
||||
)
|
||||
session.add(document)
|
||||
await session.flush()
|
||||
source = Source(
|
||||
@@ -60,16 +68,20 @@ async def test_document_print_preview_and_safe_media_route(app_client):
|
||||
assert response.status_code == 200
|
||||
assert "Print & Preserve" in response.text
|
||||
assert "<script>unsafe()</script>" in response.text
|
||||
assert "Document Type" in response.text
|
||||
assert "Photograph" in response.text
|
||||
assert "Facsimile" in response.text
|
||||
assert "Text only" in response.text
|
||||
assert "print-page-break" in response.text
|
||||
assert "print-source-pdf" in response.text
|
||||
assert "print-source-image" in response.text
|
||||
assert str(media_path) not in response.text
|
||||
assert str(pdf_path) not in response.text
|
||||
|
||||
media_response = client.get(f"/api/v4/documents/{document_id}/sources/{source_id}/media")
|
||||
assert media_response.status_code == 200
|
||||
assert media_response.headers["content-type"] == "image/png"
|
||||
assert "content-disposition" not in media_response.headers
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
|
||||
Reference in New Issue
Block a user