V4.2 complete

This commit is contained in:
Jim Lancaster
2026-08-14 15:59:38 -05:00
parent 6bd4cbb0a7
commit c9f5dca064
12 changed files with 282 additions and 21 deletions
+36
View File
@@ -17,6 +17,7 @@ from transcription.services.jobs import JobDeleteBlockedError
from transcription.services.jobs import JobNotFoundError
from transcription.services.jobs import JobResubmitBlockedError
from transcription.services.jobs import JobService
from transcription.services.sources import SourceService
class TestJobService:
@@ -232,6 +233,41 @@ class TestJobService:
with pytest.raises(JobNotFoundError):
await job_service.read_job(job_id=job.id)
@pytest.mark.asyncio
async def test_delete_job_and_evidence_removes_attempts_but_preserves_source(
self,
job_service: JobService,
document_service: DocumentService,
):
source_service = SourceService(session_factory=job_service.session_factory)
document = await document_service.create_document(Document(name="evidence-delete-doc"))
job = await job_service.create_job(Job(document_id=document.id, status=JobStatus.FAILED))
source = await source_service.create_source(
Source(
document_id=document.id,
page_number=1,
upload_name="evidence.jpg",
filename="evidence.jpg",
file_path="/uploads/evidence.jpg",
file_hash="d" * 64,
file_size_bytes=1,
)
)
await source_service.create_job_source(JobSource(job_id=job.id, source_id=source.id))
await source_service.update_job_source_transcription(
job_id=job.id,
source_id=source.id,
text=None,
error_detail="fixture failure",
)
await job_service.delete_job_and_evidence(job_id=job.id)
with pytest.raises(JobNotFoundError):
await job_service.read_job(job_id=job.id)
assert await source_service.list_execution_attempts(job_id=job.id) == []
assert (await source_service.read_source(source.id)).id == source.id
@pytest.mark.asyncio
async def test_cancel_job_marks_non_transcribed_sources_failed(
self,