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) return await self.route(*args, **kwargs)
data = {"working": True} @app.get("/")
@SomeDecorator @SomeDecorator
async def route(): async def route1():
return data return {"working": True}
app = FastAPI()
app.get("/")(route)
client = TestClient(app) client = TestClient(app)
def test_endpoint_with_async_class_decorator(): def test_endpoint_with_async_class_decorator():
response = client.get("/") response = client.get("/")
assert data == response.json() assert response.json() == {"working": True}

Loading…
Cancel
Save