V4.3 revision to Document Types

This commit is contained in:
Jim Lancaster
2026-08-15 13:29:53 -05:00
parent aed827babe
commit a78b58ff40
30 changed files with 1481 additions and 291 deletions
+8 -28
View File
@@ -48,9 +48,7 @@ class TestSourceModelProperties:
async with session_scope() as session:
job = await session.get(Job, job_id)
assert job is not None
source = (
await session.exec(select(Source).where(Source.document_id == job.document_id))
).first()
source = (await session.exec(select(Source).where(Source.document_id == job.document_id))).first()
assert source is not None
# Validate computed properties
@@ -159,9 +157,7 @@ class TestSourcesPageRendering:
assert "job-page.png" in response.text
@pytest.mark.asyncio
async def test_sources_page_job_context_shows_job_source_status_and_error_detail(
self, app_client, seed_job
):
async def test_sources_page_job_context_shows_job_source_status_and_error_detail(self, app_client, seed_job):
_, client = app_client
job_id = await seed_job(
filename="job-failed-page.png",
@@ -178,17 +174,9 @@ class TestSourcesPageRendering:
assert "Provider timed out" in response.text
@pytest.mark.asyncio
async def test_source_detail_page_renders_preview_and_revision_box(
self, app_client, seed_job
):
async def test_source_detail_page_renders_preview_and_revision_box(self, app_client, seed_job):
_, client = app_client
fixture_path = (
Path(__file__).resolve().parents[1]
/ "fixtures"
/ "images"
/ "valid"
/ "small_png.png"
)
fixture_path = Path(__file__).resolve().parents[1] / "fixtures" / "images" / "valid" / "small_png.png"
job_id = await seed_job(
filename="detail-source.png",
transcription_text="original transcription text",
@@ -201,9 +189,7 @@ class TestSourcesPageRendering:
async with session_scope() as session:
job = await session.get(Job, job_id)
assert job is not None
source = (
await session.exec(select(Source).where(Source.document_id == job.document_id))
).first()
source = (await session.exec(select(Source).where(Source.document_id == job.document_id))).first()
assert source is not None
source_id = str(source.id)
@@ -232,9 +218,7 @@ class TestSourcesPageRendering:
async with session_scope(session_factory=app.state.runtime.session_factory) as session:
job = await session.get(Job, job_id)
assert job is not None
source = (
await session.exec(select(Source).where(Source.document_id == job.document_id))
).first()
source = (await session.exec(select(Source).where(Source.document_id == job.document_id))).first()
assert source is not None
source_id = source.id
@@ -268,18 +252,14 @@ class TestSourcesPageRendering:
assert "Derived Artifacts" in response.text
@pytest.mark.asyncio
async def test_source_delete_page_blocks_when_source_is_job_linked(
self, app_client, seed_job
):
async def test_source_delete_page_blocks_when_source_is_job_linked(self, app_client, seed_job):
_, client = app_client
job_id = await seed_job(filename="linked-source.png", transcription_text="linked text")
async with session_scope() as session:
job = await session.get(Job, job_id)
assert job is not None
source = (
await session.exec(select(Source).where(Source.document_id == job.document_id))
).first()
source = (await session.exec(select(Source).where(Source.document_id == job.document_id))).first()
assert source is not None
source_id = str(source.id)