generated from john/python-template
V4.4 revision to facsimile print format
This commit is contained in:
@@ -107,7 +107,10 @@ async def test_document_print_projection_uses_semantic_author_and_current_text(d
|
||||
people = PeopleService(session_factory=default_session_factory)
|
||||
sources = SourceService(session_factory=default_session_factory)
|
||||
jobs = JobService(session_factory=default_session_factory)
|
||||
document = await documents.create_document(Document(name="Print Me", notes="Archive note"))
|
||||
document_type = await documents.create_document_type(label="Print Type")
|
||||
document = await documents.create_document(
|
||||
Document(name="Print Me", notes="Archive note", document_type_id=document_type.id)
|
||||
)
|
||||
person = await people.create_person(Person(full_name="Historic Author"))
|
||||
|
||||
async with people._session_scope() as session:
|
||||
@@ -160,6 +163,7 @@ async def test_document_print_projection_uses_semantic_author_and_current_text(d
|
||||
projection = await documents.read_document_print_projection(document.id)
|
||||
|
||||
assert projection.authors == ("Historic Author",)
|
||||
assert projection.document_type == "Print Type"
|
||||
assert [source.page_number for source in projection.sources] == [1, 2]
|
||||
assert [source.current_text for source in projection.sources] == ["raw first", "revised second"]
|
||||
assert [source.media_type for source in projection.sources] == ["image/png", "image/png"]
|
||||
|
||||
@@ -125,6 +125,8 @@ class TestDocumentsPageRendering:
|
||||
assert "Letter from Hig" in response.text
|
||||
assert "ZC-1924-001" in response.text
|
||||
assert "Zenna Cochran" in response.text
|
||||
assert "Document Type:" in response.text
|
||||
assert "Letter" in response.text
|
||||
assert "PIPELINE JOBS" in response.text.upper()
|
||||
assert "Edit Document" in response.text
|
||||
|
||||
|
||||
@@ -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