generated from john/python-template
Jobs: big jobs stuck in queue. Added Cancel, Resubmit
This commit is contained in:
@@ -86,7 +86,7 @@ class TestPageRendering:
|
||||
assert "document links" in response.text.lower()
|
||||
assert "Sources" in response.text
|
||||
assert "Jobs" in response.text
|
||||
assert "Delete job" not in response.text
|
||||
assert "Delete Job" in response.text
|
||||
|
||||
def test_job_detail_page_rejects_invalid_id(self, app_client):
|
||||
"""GET /ui/jobs/{job_id} shows validation feedback for malformed IDs."""
|
||||
@@ -105,19 +105,41 @@ class TestPageRendering:
|
||||
assert response.status_code == 200
|
||||
assert "Job not found" in response.text
|
||||
|
||||
def test_job_detail_page_hides_delete_action(self, app_client, seed_job):
|
||||
"""GET /ui/jobs/{job_id} does not expose job deletion controls in this revision."""
|
||||
def test_job_detail_page_shows_cancel_and_resubmit_when_queued(self, app_client, seed_job):
|
||||
"""GET /ui/jobs/{job_id} exposes cancel/resubmit controls for queued jobs."""
|
||||
_, client = app_client
|
||||
job_id = seed_job(
|
||||
filename="no-revision.pdf",
|
||||
status=JobStatus.TRANSCRIBED,
|
||||
transcription_text="original text",
|
||||
status=JobStatus.QUEUED,
|
||||
transcription_text=None,
|
||||
)
|
||||
|
||||
response = client.get(f"/ui/jobs/{job_id}")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Delete job" not in response.text
|
||||
assert "Cancel" in response.text
|
||||
assert "Resubmit" in response.text
|
||||
assert "Delete Job" in response.text
|
||||
|
||||
def test_job_cancel_page_renders_confirmation(self, app_client, seed_job):
|
||||
_, client = app_client
|
||||
job_id = seed_job(filename="cancel-ready.pdf", status=JobStatus.PROCESSING)
|
||||
|
||||
response = client.get(f"/ui/jobs/{job_id}/cancel")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Cancel Processing Job" in response.text
|
||||
assert "Cancel job" in response.text
|
||||
|
||||
def test_job_resubmit_page_renders_confirmation(self, app_client, seed_job):
|
||||
_, client = app_client
|
||||
job_id = seed_job(filename="resubmit-ready.pdf", status=JobStatus.FAILED, transcription_text=None)
|
||||
|
||||
response = client.get(f"/ui/jobs/{job_id}/resubmit")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Resubmit Job" in response.text
|
||||
assert "Resubmit now" in response.text
|
||||
|
||||
def test_job_delete_page_shows_confirmation_when_not_processing(self, app_client, seed_job):
|
||||
_, client = app_client
|
||||
|
||||
Reference in New Issue
Block a user