generated from john/python-template
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
"""Tests for the jobs page route."""
|
|
|
|
import pytest
|
|
from fastapi import FastAPI
|
|
from fastapi.testclient import TestClient
|
|
|
|
from transcription.ui import register_pages
|
|
from transcription.ui.pages import jobs_page
|
|
|
|
|
|
@pytest.fixture
|
|
def client(monkeypatch):
|
|
"""Provide a minimal app client with jobs data patched for rendering."""
|
|
|
|
async def _fetch_jobs_stub():
|
|
return []
|
|
|
|
monkeypatch.setattr(jobs_page, "fetch_jobs", _fetch_jobs_stub)
|
|
|
|
app = FastAPI()
|
|
register_pages(app)
|
|
with TestClient(app) as test_client:
|
|
yield test_client
|
|
|
|
|
|
@pytest.mark.integration
|
|
class TestPageRendering:
|
|
"""Verify the jobs page is available and includes the main controls."""
|
|
|
|
def test_jobs_page_renders_expected_controls(self, client):
|
|
"""GET /ui/jobs returns the page shell and jobs controls."""
|
|
response = client.get("/ui/jobs")
|
|
|
|
assert response.status_code == 200
|
|
assert "Transcription Jobs" in response.text
|
|
assert "Refresh" in response.text
|
|
assert "Back to upload" in response.text
|