MCPcopy
hub / github.com/fastapi/fastapi / test_apirouter_frontend_uses_include_prefix

Function test_apirouter_frontend_uses_include_prefix

tests/test_frontend.py:837–848  ·  view source on GitHub ↗
(tmp_path: Path)

Source from the content-addressed store, hash-verified

835
836
837def test_apirouter_frontend_uses_include_prefix(tmp_path: Path):
838 dist = tmp_path / "admin"
839 write_file(dist / "index.html", "admin")
840 router = APIRouter()
841 router.frontend("/", directory=dist, fallback="index.html")
842 app = FastAPI()
843 app.include_router(router, prefix="/admin")
844
845 response = TestClient(app).get("/admin/settings", headers={"accept": "text/html"})
846
847 assert response.status_code == 200
848 assert response.text == "admin"
849
850
851def test_global_priority_across_included_routers(tmp_path: Path):

Callers

nothing calls this directly

Calls 6

frontendMethod · 0.95
include_routerMethod · 0.95
APIRouterClass · 0.90
FastAPIClass · 0.90
write_fileFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…