generated from john/python-template
V4.4 Complete
This commit is contained in:
@@ -9,10 +9,10 @@ from sqlmodel import select
|
||||
from transcription.db import session_scope
|
||||
from transcription.db.models import Document
|
||||
from transcription.db.models import DocumentPerson
|
||||
from transcription.db.models import DocumentPersonRole
|
||||
from transcription.db.models import DocumentType
|
||||
from transcription.db.models import Job
|
||||
from transcription.db.models import Person
|
||||
from transcription.db.models import PersonRole
|
||||
from transcription.db.models import Source
|
||||
|
||||
# --- Helper Fixtures ---
|
||||
@@ -23,6 +23,7 @@ async def seed_person_and_document():
|
||||
"""Seed a Person and Document linked by DocumentPerson role."""
|
||||
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")
|
||||
session.add(person)
|
||||
await session.flush()
|
||||
@@ -38,7 +39,7 @@ async def seed_person_and_document():
|
||||
link = DocumentPerson(
|
||||
document_id=doc.id,
|
||||
person_id=person.id,
|
||||
role=DocumentPersonRole.AUTHOR,
|
||||
role_id=author_role.id,
|
||||
)
|
||||
session.add(link)
|
||||
await session.commit()
|
||||
@@ -92,7 +93,7 @@ class TestDocumentsPageRendering:
|
||||
assert response.status_code == 200
|
||||
assert "Create Document" in response.text
|
||||
assert "Document name" in response.text
|
||||
assert "Linked People by Role" in response.text
|
||||
assert "Linked People" in response.text
|
||||
assert "Document type" in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -132,7 +133,7 @@ class TestDocumentsPageRendering:
|
||||
_, client = app_client
|
||||
|
||||
async with session_scope() as session:
|
||||
doc = Document(name="Doc With Job", document_type="letter")
|
||||
doc = Document(name="Doc With Job")
|
||||
session.add(doc)
|
||||
await session.flush()
|
||||
|
||||
@@ -165,7 +166,7 @@ class TestDocumentsPageRendering:
|
||||
_, client = app_client
|
||||
|
||||
async with session_scope() as session:
|
||||
doc = Document(name="Doc With Source", document_type="letter")
|
||||
doc = Document(name="Doc With Source")
|
||||
session.add(doc)
|
||||
await session.flush()
|
||||
|
||||
@@ -194,7 +195,7 @@ class TestDocumentsPageRendering:
|
||||
_, client = app_client
|
||||
|
||||
async with session_scope() as session:
|
||||
doc = Document(name="Orphan Document", document_type="note")
|
||||
doc = Document(name="Orphan Document")
|
||||
session.add(doc)
|
||||
await session.commit()
|
||||
doc_id = str(doc.id)
|
||||
|
||||
Reference in New Issue
Block a user