generated from john/python-template
@@ -12,6 +12,7 @@ from transcription.db.models import Document
|
||||
from transcription.db.models import DocumentPerson
|
||||
from transcription.db.models import Person
|
||||
from transcription.db.models import PersonRole
|
||||
from transcription.db.models import Source
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
@@ -55,6 +56,9 @@ class TestPeoplePageRendering:
|
||||
assert "Birth date (YYYY-MM-DD)" not in response.text
|
||||
assert "Death date (YYYY-MM-DD)" not in response.text
|
||||
assert "FamilySearch ID" in response.text
|
||||
assert "Auto-fill from FamilySearch" not in response.text
|
||||
assert "Marriage date (FamilySearch)" not in response.text
|
||||
assert "Spouse (FamilySearch)" not in response.text
|
||||
assert "Biography" in response.text
|
||||
assert "Save person" in response.text
|
||||
|
||||
@@ -92,11 +96,16 @@ class TestPeoplePageRendering:
|
||||
assert "1906-12-09" in response.text
|
||||
assert "Death Date:" in response.text
|
||||
assert "1992-01-01" in response.text
|
||||
assert "Open Birth Place in Google Maps" not in response.text
|
||||
assert "Open Death Place in Google Maps" not in response.text
|
||||
assert "google.com/maps/search/?api=1&query=New+York" in response.text
|
||||
assert "google.com/maps/search/?api=1&query=Arlington" in response.text
|
||||
assert "biography" in response.text.lower()
|
||||
assert "Computer pioneer" in response.text
|
||||
assert "Created:" in response.text
|
||||
assert "Updated:" in response.text
|
||||
assert "Open in FamilySearch" in response.text
|
||||
assert "Open in FamilySearch" not in response.text
|
||||
assert "FamilySearch ID:" in response.text
|
||||
assert "familysearch.org/tree/person/details/G8T4-MDQ" in response.text
|
||||
assert "New Document" in response.text
|
||||
assert "No linked documents yet." in response.text
|
||||
@@ -134,6 +143,28 @@ class TestPeoplePageRendering:
|
||||
document = Document(name="Linked Document")
|
||||
session.add_all([person, document])
|
||||
await session.flush()
|
||||
session.add_all(
|
||||
[
|
||||
Source(
|
||||
document_id=document.id,
|
||||
page_number=1,
|
||||
upload_name="linked-page-1.png",
|
||||
filename="linked-page-1.png",
|
||||
file_path="/tmp/linked-page-1.png",
|
||||
file_hash="1" * 64,
|
||||
file_size_bytes=1,
|
||||
),
|
||||
Source(
|
||||
document_id=document.id,
|
||||
page_number=2,
|
||||
upload_name="linked-page-2.png",
|
||||
filename="linked-page-2.png",
|
||||
file_path="/tmp/linked-page-2.png",
|
||||
file_hash="2" * 64,
|
||||
file_size_bytes=1,
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
session.add(
|
||||
DocumentPerson(
|
||||
@@ -148,8 +179,27 @@ class TestPeoplePageRendering:
|
||||
response = client.get(f"/ui/people/{person_id}")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Document Name" in response.text
|
||||
assert "Number of Pages" in response.text
|
||||
assert "Linked Document" in response.text
|
||||
assert "Role: Author" in response.text
|
||||
assert "Author" in response.text
|
||||
assert '"page_count":2' in response.text
|
||||
assert "Open" not in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_person_detail_page_hides_empty_maiden_name(self, app_client):
|
||||
_, client = app_client
|
||||
|
||||
async with session_scope() as session:
|
||||
person = Person(full_name="No Maiden Name")
|
||||
session.add(person)
|
||||
await session.commit()
|
||||
person_id = str(person.id)
|
||||
|
||||
response = client.get(f"/ui/people/{person_id}")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Maiden Name:" not in response.text
|
||||
|
||||
def test_person_detail_page_handles_invalid_id(self, app_client):
|
||||
_, client = app_client
|
||||
|
||||
Reference in New Issue
Block a user