generated from john/python-template
v5.0 Introduce centralized homepage & portrait photo management
Quality Gate / gate (push) Failing after 11s
Quality Gate / gate (push) Failing after 11s
This commit is contained in:
@@ -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 Photo
|
||||
from transcription.db.models import Source
|
||||
|
||||
|
||||
@@ -99,7 +100,6 @@ class TestPeoplePageRendering:
|
||||
death_date_raw="1992",
|
||||
death_place="Arlington",
|
||||
biography="Computer pioneer",
|
||||
portrait_path="/images/grace.jpg",
|
||||
family_search_id="G8T4-MDQ",
|
||||
)
|
||||
session.add(person)
|
||||
@@ -132,20 +132,25 @@ class TestPeoplePageRendering:
|
||||
assert "No linked documents yet." in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_person_detail_page_resolves_relative_portrait_path(self, app_client):
|
||||
async def test_person_detail_page_resolves_relative_photo_path(self, app_client):
|
||||
app, client = app_client
|
||||
upload_dirs = {app.state.settings.upload_dir, get_settings().upload_dir}
|
||||
for upload_dir in upload_dirs:
|
||||
portrait_file = upload_dir / "persons" / "person" / "seeded.png"
|
||||
portrait_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
portrait_file.write_bytes(b"portrait")
|
||||
photo_file = upload_dir / "photos" / "seeded.png"
|
||||
photo_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
photo_file.write_bytes(b"portrait")
|
||||
|
||||
async with session_scope() as session:
|
||||
person = Person(
|
||||
full_name="Portrait Person",
|
||||
portrait_path="persons/person/seeded.png",
|
||||
)
|
||||
person = Person(full_name="Portrait Person")
|
||||
session.add(person)
|
||||
await session.flush()
|
||||
session.add(
|
||||
Photo(
|
||||
person_id=person.id,
|
||||
path="photos/seeded.png",
|
||||
is_primary=True,
|
||||
)
|
||||
)
|
||||
await session.commit()
|
||||
person_id = str(person.id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user