generated from john/python-template
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
"""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."""
|
|
|
|
def test_register_pages_wires_upload_jobs_and_mount(self, monkeypatch):
|
|
"""register_pages registers pages and mounts NiceGUI at /ui."""
|
|
calls: list[str] = []
|
|
|
|
def _record_upload() -> None:
|
|
calls.append("upload")
|
|
|
|
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"]
|