generated from john/python-template
This commit is contained in:
@@ -14,6 +14,7 @@ from transcription.db.models import Job
|
||||
from transcription.db.models import Person
|
||||
from transcription.db.models import PersonRole
|
||||
from transcription.db.models import Source
|
||||
from transcription.ui.pages.documents_page import _resolve_selected_tag_labels
|
||||
|
||||
# --- Helper Fixtures ---
|
||||
|
||||
@@ -81,9 +82,10 @@ class TestDocumentsPageRendering:
|
||||
assert response.status_code == 200
|
||||
assert "1924 Postcard" in response.text
|
||||
assert "Postcard" in response.text
|
||||
assert "PC-001" in response.text
|
||||
assert "Document Date" in response.text
|
||||
assert "Author" in response.text
|
||||
assert "# Sources" in response.text
|
||||
assert "Archive Ref" not in response.text
|
||||
|
||||
def test_document_create_page_renders_form(self, app_client):
|
||||
_, client = app_client
|
||||
@@ -95,6 +97,7 @@ class TestDocumentsPageRendering:
|
||||
assert "Document name" in response.text
|
||||
assert "Linked People" in response.text
|
||||
assert "Document type" in response.text
|
||||
assert "Tags" in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_document_create_page_preselects_person_with_disambiguating_label(self, app_client):
|
||||
@@ -209,3 +212,10 @@ class TestDocumentsPageRendering:
|
||||
assert "Delete Document" in response.text
|
||||
assert "Delete document permanently" in response.text
|
||||
assert "Delete is blocked" not in response.text
|
||||
|
||||
|
||||
def test_resolve_selected_tag_labels_handles_multiple_payload_shapes():
|
||||
assert _resolve_selected_tag_labels("Family") == ["Family"]
|
||||
assert _resolve_selected_tag_labels(["Family", "Research"]) == ["Family", "Research"]
|
||||
assert _resolve_selected_tag_labels([{"label": "Family"}, {"value": "Research"}]) == ["Family", "Research"]
|
||||
assert set(_resolve_selected_tag_labels({"value": {"Family", "Research"}})) == {"Family", "Research"}
|
||||
|
||||
Reference in New Issue
Block a user