generated from john/python-template
model used being carried thru
This commit is contained in:
@@ -1,39 +1,18 @@
|
||||
"""Tests for UI page registration wiring."""
|
||||
|
||||
import pytest
|
||||
from fastapi import FastAPI
|
||||
|
||||
from transcription.ui import register_pages
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
class TestPageRegistration:
|
||||
"""Verify page registration and route wiring."""
|
||||
"""Verify page registration and mounted UI routes."""
|
||||
|
||||
def test_register_pages_wires_upload_jobs_and_mount(self, monkeypatch):
|
||||
"""register_pages registers pages and mounts NiceGUI at /ui."""
|
||||
calls: list[str] = []
|
||||
def test_ui_mount_serves_registered_pages(self, app_client):
|
||||
"""Mounted UI routes respond successfully when the full app is created."""
|
||||
_, client = app_client
|
||||
|
||||
def _record_upload() -> None:
|
||||
calls.append("upload")
|
||||
upload_response = client.get("/ui/upload")
|
||||
jobs_response = client.get("/ui/jobs")
|
||||
|
||||
def _record_jobs() -> None:
|
||||
calls.append("jobs")
|
||||
|
||||
def _record_run_with(
|
||||
_app: FastAPI,
|
||||
*,
|
||||
mount_path: str,
|
||||
show_welcome_message: bool,
|
||||
dark: bool,
|
||||
) -> None:
|
||||
calls.append(f"run_with:{mount_path}:{show_welcome_message}:{dark}")
|
||||
|
||||
monkeypatch.setattr("transcription.ui.register_upload_page", _record_upload)
|
||||
monkeypatch.setattr("transcription.ui.register_jobs_page", _record_jobs)
|
||||
monkeypatch.setattr("transcription.ui.ui.run_with", _record_run_with)
|
||||
|
||||
app = FastAPI()
|
||||
register_pages(app)
|
||||
|
||||
assert calls == ["upload", "jobs", "run_with:/ui:False:True"]
|
||||
assert upload_response.status_code == 200
|
||||
assert jobs_response.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user