Motov Yurii
2 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
4 additions and
10 deletions
-
tests/test_endpoint_with_async_class_decorator.py
|
|
@ -13,20 +13,14 @@ class SomeDecorator: |
|
|
|
return await self.route(*args, **kwargs) |
|
|
|
|
|
|
|
|
|
|
|
data = {"working": True} |
|
|
|
|
|
|
|
|
|
|
|
@app.get("/") |
|
|
|
@SomeDecorator |
|
|
|
async def route(): |
|
|
|
return data |
|
|
|
|
|
|
|
|
|
|
|
app = FastAPI() |
|
|
|
app.get("/")(route) |
|
|
|
async def route1(): |
|
|
|
return {"working": True} |
|
|
|
|
|
|
|
client = TestClient(app) |
|
|
|
|
|
|
|
|
|
|
|
def test_endpoint_with_async_class_decorator(): |
|
|
|
response = client.get("/") |
|
|
|
assert data == response.json() |
|
|
|
assert response.json() == {"working": True} |
|
|
|