conftest.py 365 B

12345678910111213141516
  1. import pytest
  2. from httpx import AsyncClient, ASGITransport
  3. from app.main import app
  4. @pytest.fixture
  5. async def client():
  6. transport = ASGITransport(app=app)
  7. async with AsyncClient(transport=transport, base_url="http://test") as ac:
  8. yield ac
  9. @pytest.fixture
  10. async def health_response(client):
  11. resp = await client.get("/health")
  12. return resp