16 lines
434 B
Python
16 lines
434 B
Python
from typing import AsyncGenerator
|
|
|
|
import pytest
|
|
from httpx import AsyncClient, ASGITransport
|
|
|
|
from app.main import app
|
|
|
|
|
|
@pytest.fixture
|
|
async def test_client() -> AsyncGenerator[AsyncClient, None]:
|
|
# On crée un "transport" pour l'application ASGI
|
|
transport = ASGITransport(app=app)
|
|
async with AsyncClient(transport=transport, base_url="http://test") as client:
|
|
yield client
|
|
app.dependency_overrides.clear()
|