Add example for calling async test client

This commit is contained in:
Yerassyl Zhanymkanov
2022-08-19 01:37:02 +06:00
parent e6ad6c7a26
commit f38c816160

View File

@@ -522,6 +522,13 @@ async def client():
app, scope=scope, headers={"X-User-Fingerprint": "Test"} app, scope=scope, headers={"X-User-Fingerprint": "Test"}
) as client: ) as client:
yield client yield client
@pytest.mark.asyncio
async def test_create_post(client: TestClient):
resp = await client.post("/posts")
assert resp.status_code == 201
``` ```
Unless you have sync db connection (excuse me?) or aren't planning to write integration tests. Unless you have sync db connection (excuse me?) or aren't planning to write integration tests.
### 16. Set postgres identity from day 0 ### 16. Set postgres identity from day 0