mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
Fix test_multiple_decorators unit test for FastAPI 0.118.0
Fix the following error in test_galaxy_packages: FAILED tests/webapps/api/test_cbv.py::test_multiple_decorators - AssertionError: fastapi_middleware_astack not found in request scope xref. https://github.com/fastapi/fastapi/issues/14128
This commit is contained in:
@@ -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"}
|
||||
|
||||
Reference in New Issue
Block a user