Browse Source

🎨 Auto format

pull/14984/head
pre-commit-ci-lite[bot] 5 months ago
committed by GitHub
parent
commit
3d7667ae1d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 11
      tests/test_router_mount.py

11
tests/test_router_mount.py

@ -1,20 +1,23 @@
from fastapi import FastAPI, APIRouter
from fastapi.testclient import TestClient
from fastapi import APIRouter, FastAPI
app = FastAPI()
api_router = APIRouter(prefix="/api")
@api_router.get("/app")
def read_main():
return {"message": "Hello World from main app"}
subapi = FastAPI()
@subapi.get("/sub")
def read_sub():
return {"message": "Hello World from sub API"}
api_router.mount("/subapi", subapi) # ← moved up
app.include_router(api_router) # ← now after
app.include_router(api_router) # ← now after
print("All tests passed.")
print("All tests passed.")

Loading…
Cancel
Save