Skip to content

Commit 8b15bc3

Browse files
committed
Merge branch 'release_24.2' into release_25.0
2 parents 7a5abce + ef14b2b commit 8b15bc3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/unit/webapps/api/test_cbv.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,14 @@ def get_item(self) -> int: # Alphabetically before `get_test`
7070

7171
app = FastAPI()
7272
app.include_router(router)
73+
client = TestClient(app)
7374

74-
assert TestClient(app).get("/test").json() == 1
75-
assert TestClient(app).get("/other").json() == 2
75+
assert client.get("/test").json() == 1
76+
assert client.get("/other").json() == 2
7677

7778

7879
def test_multiple_decorators() -> None:
80+
app = FastAPI()
7981
router = APIRouter()
8082

8183
@cbv(router)
@@ -90,7 +92,9 @@ def root(self, item_path: Optional[str] = None, item_query: Optional[str] = None
9092
return {"item_query": item_query}
9193
return []
9294

93-
client = TestClient(router)
95+
app = FastAPI()
96+
app.include_router(router)
97+
client = TestClient(app)
9498

9599
assert client.get("/items").json() == []
96100
assert client.get("/items/1").json() == {"item_path": "1"}

0 commit comments

Comments
 (0)