generated from john/python-template
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
"""Tests for UI entry-points, redirects, and page mounting health-checks."""
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.mark.integration
|
|
class TestNavigationAndMounts:
|
|
"""Verify application entry-point redirects and route mounting."""
|
|
|
|
@pytest.mark.parametrize(
|
|
("url", "expected_status", "expected_redirect"),
|
|
[
|
|
("/", 307, "/ui/homepage"),
|
|
("/ui", 307, "/ui/homepage"),
|
|
("/ui/upload", 307, "/ui/jobs/new"),
|
|
],
|
|
)
|
|
def test_entrypoint_redirects(self, app_client, url: str, expected_status: int, expected_redirect: str):
|
|
"""Verify root and legacy routes redirect to primary UI views."""
|
|
_, client = app_client
|
|
response = client.get(url, follow_redirects=False)
|
|
|
|
assert response.status_code == expected_status
|
|
assert response.headers["location"] == expected_redirect
|
|
|
|
@pytest.mark.parametrize(
|
|
"route_path",
|
|
[
|
|
"/ui/homepage",
|
|
"/ui/homepage/edit",
|
|
"/ui/documents",
|
|
"/ui/people",
|
|
"/ui/sources",
|
|
"/ui/jobs",
|
|
],
|
|
)
|
|
def test_registered_pages_render_successfully(self, app_client, route_path: str):
|
|
"""Smoke test verifying all primary UI routes respond with 200 OK."""
|
|
_, client = app_client
|
|
response = client.get(route_path)
|
|
|
|
assert response.status_code == 200
|
|
assert "html" in response.headers.get("content-type", "").lower() |