generated from john/python-template
@@ -54,8 +54,38 @@ class TestJobsPageRendering:
|
||||
response = client.get("/ui/jobs")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Document Name" in response.text
|
||||
assert "Source Filename" not in response.text
|
||||
assert "Updated" in response.text
|
||||
assert "Created" not in response.text
|
||||
assert str(job_id) in response.text
|
||||
assert "seeded-document-page.png" in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_jobs_page_filters_for_document_context(self, app_client):
|
||||
_, client = app_client
|
||||
|
||||
async with session_scope() as session:
|
||||
first = Document(name="First Doc")
|
||||
second = Document(name="Second Doc")
|
||||
session.add_all([first, second])
|
||||
await session.flush()
|
||||
first_job = Job(document_id=first.id, status=JobStatus.QUEUED, provider="openai", model="gpt-4o")
|
||||
second_job = Job(document_id=second.id, status=JobStatus.QUEUED, provider="openai", model="gpt-4o")
|
||||
session.add_all([first_job, second_job])
|
||||
await session.commit()
|
||||
|
||||
first_id = str(first.id)
|
||||
first_job_id = str(first_job.id)
|
||||
second_job_id = str(second_job.id)
|
||||
|
||||
response = client.get(f"/ui/jobs?document_id={first_id}")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "Jobs for Document" in response.text
|
||||
assert "Create job" not in response.text
|
||||
assert "Refresh" not in response.text
|
||||
assert first_job_id in response.text
|
||||
assert second_job_id not in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_job_create_page_shows_empty_document_warning_when_no_docs(self, app_client):
|
||||
@@ -95,8 +125,11 @@ class TestJobsPageRendering:
|
||||
assert "Execution Logistics".upper() in response.text.upper()
|
||||
assert "openai" in response.text
|
||||
assert "gpt-4o" in response.text
|
||||
assert "View Linked Document" in response.text
|
||||
assert "View Linked Sources" in response.text
|
||||
assert "Document Name:" in response.text
|
||||
assert "Sources:" in response.text
|
||||
assert "View Sources" in response.text
|
||||
assert "View Linked Document" not in response.text
|
||||
assert "View Linked Sources" not in response.text
|
||||
assert "updates automatically while the job is active" in response.text
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user