Browse Source

Simplify the code of test

pull/11200/head
Motov Yurii 2 weeks ago
committed by GitHub
parent
commit
8069651441
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 14
      tests/test_endpoint_with_async_class_decorator.py

14
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}

Loading…
Cancel
Save