generated from john/python-template
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user