generated from john/python-template
V5.1 Modify Person table: split full name into first & last, added tags support
Quality Gate / gate (push) Failing after 11s
Quality Gate / gate (push) Failing after 11s
This commit is contained in:
@@ -28,7 +28,7 @@ async def seed_person_and_document():
|
||||
async with session_scope() as session:
|
||||
letter_type = (await session.exec(select(DocumentType).where(DocumentType.label == "Letter"))).one()
|
||||
author_role = (await session.exec(select(PersonRole).where(PersonRole.semantic_key == "author"))).one()
|
||||
person = Person(full_name="Zenna Cochran")
|
||||
person = Person(given_names="Zenna", last_name="Cochran")
|
||||
session.add(person)
|
||||
await session.flush()
|
||||
|
||||
@@ -122,8 +122,8 @@ class TestDocumentsPageRendering:
|
||||
_, client = app_client
|
||||
async with session_scope() as session:
|
||||
person = Person(
|
||||
full_name="Albert Edward Higgins",
|
||||
display_name="Hig",
|
||||
given_names="Albert Edward",
|
||||
last_name="Higgins",
|
||||
birth_date=date(1885, 1, 2),
|
||||
)
|
||||
session.add(person)
|
||||
@@ -133,7 +133,7 @@ class TestDocumentsPageRendering:
|
||||
response = client.get(f"/ui/documents/new?person_id={person_id}")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Hig - Albert Edward Higgins (1885)" in response.text
|
||||
assert "Albert Edward Higgins (1885)" in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_document_detail_page_renders_bento_grid_and_metadata(self, app_client, seed_person_and_document):
|
||||
|
||||
@@ -15,18 +15,18 @@ def test_compact_date_prefers_exact_then_approximate_then_unknown():
|
||||
|
||||
def test_person_selector_label_disambiguates_without_changing_identity():
|
||||
person = Person(
|
||||
full_name="Albert Edward Higgins",
|
||||
display_name="Hig",
|
||||
given_names="Albert Edward",
|
||||
last_name="Higgins",
|
||||
birth_date=date(1885, 1, 2),
|
||||
)
|
||||
assert person_selector_label(person) == "Hig - Albert Edward Higgins (1885)"
|
||||
assert person_selector_label(person) == "Albert Edward Higgins (1885)"
|
||||
|
||||
approximate = Person(
|
||||
full_name="Albert Edward Higgins",
|
||||
display_name="Hig",
|
||||
given_names="Albert Edward",
|
||||
last_name="Higgins",
|
||||
birth_date_raw="about 1912",
|
||||
)
|
||||
assert person_selector_label(approximate) == "Hig - Albert Edward Higgins (1912)"
|
||||
assert person_selector_label(approximate) == "Albert Edward Higgins (1912)"
|
||||
|
||||
|
||||
def test_family_search_url_uses_fixed_person_details_route():
|
||||
|
||||
@@ -35,17 +35,18 @@ class TestPeoplePageRendering:
|
||||
_, client = app_client
|
||||
|
||||
async with session_scope() as session:
|
||||
session.add(Person(full_name="Ada Lovelace", display_name="Ada"))
|
||||
session.add(Person(given_names="Ada", last_name="Lovelace"))
|
||||
await session.commit()
|
||||
|
||||
response = client.get("/ui/people")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Ada Lovelace" in response.text
|
||||
assert "Lovelace" in response.text
|
||||
assert "Ada" in response.text
|
||||
assert "Last Name" in response.text
|
||||
assert "First & Middle" in response.text or "First & Middle" in response.text
|
||||
assert "FamilySearch ID" in response.text
|
||||
assert "# Documents" in response.text
|
||||
assert "Display Name" not in response.text
|
||||
assert "Maiden Name" not in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_people_page_shows_document_counts(self, app_client):
|
||||
@@ -53,7 +54,7 @@ class TestPeoplePageRendering:
|
||||
|
||||
async with session_scope() as session:
|
||||
role = (await session.exec(select(PersonRole).where(PersonRole.semantic_key == "author"))).one()
|
||||
person = Person(full_name="Counted Person")
|
||||
person = Person(given_names="Counted", last_name="Person")
|
||||
document = Document(name="Linked For Count")
|
||||
session.add_all([person, document])
|
||||
await session.flush()
|
||||
@@ -72,7 +73,7 @@ class TestPeoplePageRendering:
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Create Person Record" in response.text
|
||||
assert "Full name is required." in response.text
|
||||
assert "Last name and first/middle names are required." in response.text
|
||||
assert "Birth date" in response.text
|
||||
assert "Death date" in response.text
|
||||
assert "Birth date (YYYY-MM-DD)" not in response.text
|
||||
@@ -90,9 +91,8 @@ class TestPeoplePageRendering:
|
||||
|
||||
async with session_scope() as session:
|
||||
person = Person(
|
||||
full_name="Grace Hopper",
|
||||
display_name="Grace",
|
||||
maiden_name="Murray",
|
||||
given_names="Grace",
|
||||
last_name="Hopper",
|
||||
birth_date=date(1906, 12, 9),
|
||||
birth_date_raw="1906",
|
||||
birth_place="New York",
|
||||
@@ -111,8 +111,8 @@ class TestPeoplePageRendering:
|
||||
assert response.status_code == 200
|
||||
assert "Grace Hopper" in response.text
|
||||
assert "Full Name:" in response.text
|
||||
assert "Display Name:" in response.text
|
||||
assert "Maiden Name:" in response.text
|
||||
assert "Last Name:" in response.text
|
||||
assert "First & Middle:" in response.text or "First & Middle:" in response.text
|
||||
assert "Birth Date:" in response.text
|
||||
assert "1906-12-09" in response.text
|
||||
assert "Death Date:" in response.text
|
||||
@@ -141,7 +141,7 @@ class TestPeoplePageRendering:
|
||||
photo_file.write_bytes(b"portrait")
|
||||
|
||||
async with session_scope() as session:
|
||||
person = Person(full_name="Portrait Person")
|
||||
person = Person(given_names="Portrait", last_name="Person")
|
||||
session.add(person)
|
||||
await session.flush()
|
||||
session.add(
|
||||
@@ -172,7 +172,7 @@ class TestPeoplePageRendering:
|
||||
photo_file.write_bytes(b"portrait")
|
||||
|
||||
async with session_scope() as session:
|
||||
person = Person(full_name="Gallery Person")
|
||||
person = Person(given_names="Gallery", last_name="Person")
|
||||
session.add(person)
|
||||
await session.flush()
|
||||
session.add(
|
||||
@@ -202,7 +202,7 @@ class TestPeoplePageRendering:
|
||||
|
||||
async with session_scope() as session:
|
||||
author_role = (await session.exec(select(PersonRole).where(PersonRole.semantic_key == "author"))).one()
|
||||
person = Person(full_name="Linked Person")
|
||||
person = Person(given_names="Linked", last_name="Person")
|
||||
document = Document(name="Linked Document")
|
||||
session.add_all([person, document])
|
||||
await session.flush()
|
||||
@@ -250,11 +250,11 @@ class TestPeoplePageRendering:
|
||||
assert "Open" not in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_person_detail_page_hides_empty_maiden_name(self, app_client):
|
||||
async def test_person_detail_page_hides_removed_maiden_name_field(self, app_client):
|
||||
_, client = app_client
|
||||
|
||||
async with session_scope() as session:
|
||||
person = Person(full_name="No Maiden Name")
|
||||
person = Person(given_names="No Maiden", last_name="Name")
|
||||
session.add(person)
|
||||
await session.commit()
|
||||
person_id = str(person.id)
|
||||
@@ -285,7 +285,7 @@ class TestPeoplePageRendering:
|
||||
_, client = app_client
|
||||
|
||||
async with session_scope() as session:
|
||||
person = Person(full_name="Editable Person", display_name="EP")
|
||||
person = Person(given_names="Editable", last_name="Person")
|
||||
session.add(person)
|
||||
await session.commit()
|
||||
person_id = str(person.id)
|
||||
@@ -294,8 +294,9 @@ class TestPeoplePageRendering:
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Edit Person Record" in response.text
|
||||
assert "Full name is required." in response.text
|
||||
assert "Editable Person" in response.text
|
||||
assert "Last name and first/middle names are required." in response.text
|
||||
assert "Editable" in response.text
|
||||
assert "Person" in response.text
|
||||
assert "Save changes" in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -303,7 +304,7 @@ class TestPeoplePageRendering:
|
||||
_, client = app_client
|
||||
|
||||
async with session_scope() as session:
|
||||
person = Person(full_name="Safe Delete")
|
||||
person = Person(given_names="Safe", last_name="Delete")
|
||||
session.add(person)
|
||||
await session.commit()
|
||||
person_id = str(person.id)
|
||||
|
||||
Reference in New Issue
Block a user