generated from john/python-template
@@ -37,6 +37,7 @@ async def seed_person_and_document():
|
||||
document_type_id=letter_type.id,
|
||||
archive_identifier="ZC-1924-001",
|
||||
document_date=date(1924, 7, 4),
|
||||
location_created="Salt Lake City, Utah",
|
||||
)
|
||||
session.add(doc)
|
||||
await session.flush()
|
||||
@@ -151,6 +152,7 @@ class TestDocumentsPageRendering:
|
||||
assert "Letter" in response.text
|
||||
assert "07-04-1924" in response.text
|
||||
assert "1924-07-04" not in response.text
|
||||
assert "google.com/maps/search/?api=1&query=Salt+Lake+City%2C+Utah" in response.text
|
||||
assert "PIPELINE JOBS" in response.text.upper()
|
||||
assert "Edit Document" in response.text
|
||||
assert "Back to Documents" in response.text
|
||||
|
||||
@@ -186,6 +186,45 @@ class TestPeoplePageRendering:
|
||||
assert response.text.count("Edit Photo(s)") == 1
|
||||
assert "Upload photo(s)" not in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_person_detail_page_shows_gallery_navigation_for_multiple_photos(self, app_client):
|
||||
app, client = app_client
|
||||
upload_dirs = {app.state.settings.upload_dir, get_settings().upload_dir}
|
||||
for upload_dir in upload_dirs:
|
||||
primary_file = upload_dir / "photos" / "portrait-primary.png"
|
||||
secondary_file = upload_dir / "photos" / "portrait-secondary.png"
|
||||
primary_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
primary_file.write_bytes(b"portrait-primary")
|
||||
secondary_file.write_bytes(b"portrait-secondary")
|
||||
|
||||
async with session_scope() as session:
|
||||
person = Person(given_names="Gallery", last_name="Navigation")
|
||||
session.add(person)
|
||||
await session.flush()
|
||||
session.add_all(
|
||||
[
|
||||
Photo(
|
||||
person_id=person.id,
|
||||
path="photos/portrait-primary.png",
|
||||
is_primary=True,
|
||||
),
|
||||
Photo(
|
||||
person_id=person.id,
|
||||
path="photos/portrait-secondary.png",
|
||||
is_primary=False,
|
||||
),
|
||||
]
|
||||
)
|
||||
await session.commit()
|
||||
person_id = str(person.id)
|
||||
|
||||
response = client.get(f"/ui/people/{person_id}")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Previous" in response.text
|
||||
assert "Next" in response.text
|
||||
assert "1 of 2" in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_person_photos_page_renders_photo_management_controls(self, app_client):
|
||||
app, client = app_client
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""Tests for the sources page routes and Source model properties."""
|
||||
|
||||
import re
|
||||
from datetime import UTC
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
@@ -198,6 +199,15 @@ class TestSourcesPageRendering:
|
||||
assert "page_one.png" in response.text
|
||||
assert "Source Document" in response.text
|
||||
assert "Stored Filename" not in response.text
|
||||
assert re.search(
|
||||
r'"name":"upload_name","label":"Upload Title".*'
|
||||
r'"name":"page_number","label":"Page Number".*'
|
||||
r'"name":"document_name","label":"Document Name".*'
|
||||
r'"name":"job_source_status","label":"Status".*'
|
||||
r'"name":"job_source_error_detail","label":"Error Detail"',
|
||||
response.text,
|
||||
re.DOTALL,
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_sources_page_filters_to_document_context(self, app_client):
|
||||
|
||||
Reference in New Issue
Block a user