35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
from fastapi import FastAPI
|
|
|
|
from src.server.controllers import (
|
|
anime_controller,
|
|
auth_controller,
|
|
episode_controller,
|
|
setup_controller,
|
|
system_controller,
|
|
)
|
|
|
|
# Avoid TestClient/httpx incompatibilities in some envs; we'll check route registration instead
|
|
|
|
|
|
|
|
def test_controllers_expose_router_objects():
|
|
# Routers should exist
|
|
assert hasattr(auth_controller, "router")
|
|
assert hasattr(anime_controller, "router")
|
|
assert hasattr(episode_controller, "router")
|
|
assert hasattr(setup_controller, "router")
|
|
assert hasattr(system_controller, "router")
|
|
|
|
|
|
def test_include_routers_in_app():
|
|
app = FastAPI()
|
|
app.include_router(auth_controller.router)
|
|
app.include_router(anime_controller.router)
|
|
app.include_router(episode_controller.router)
|
|
app.include_router(setup_controller.router)
|
|
app.include_router(system_controller.router)
|
|
|
|
# Basic sanity: the system config route should be registered on the app
|
|
paths = [r.path for r in app.routes if hasattr(r, 'path')]
|
|
assert "/api/system/config" in paths
|