Merge pull request #20982 from nsoranzo/release_24.2_fix_cbv_unit_test

[24.2] Fix ``test_multiple_decorators`` unit test for FastAPI 0.118.0
This commit is contained in:
John Davis
2025-09-30 10:37:49 -04:00
committed by GitHub
2 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ jobs:
uses: medyagh/setup-minikube@latest
with:
driver: none
kubernetes-version: '1.23.0'
kubernetes-version: '1.28.0'
- name: Check pods
run: kubectl get pods -A
- uses: actions/checkout@v4
+7 -3
View File
@@ -70,12 +70,14 @@ def test_method_order_preserved() -> None:
app = FastAPI()
app.include_router(router)
client = TestClient(app)
assert TestClient(app).get("/test").json() == 1
assert TestClient(app).get("/other").json() == 2
assert client.get("/test").json() == 1
assert client.get("/other").json() == 2
def test_multiple_decorators() -> None:
app = FastAPI()
router = APIRouter()
@cbv(router)
@@ -90,7 +92,9 @@ def test_multiple_decorators() -> None:
return {"item_query": item_query}
return []
client = TestClient(router)
app = FastAPI()
app.include_router(router)
client = TestClient(app)
assert client.get("/items").json() == []
assert client.get("/items/1").json() == {"item_path": "1"}