fix: use ASGITransport for httpx AsyncClient in tests

- httpx.AsyncClient requires ASGITransport for FastAPI app testing
- Updated all test files to use correct API
This commit is contained in:
2026-05-11 21:28:07 +02:00
parent 55ba9b62d6
commit 58c4bc7f30
6 changed files with 25 additions and 25 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ import pytest_asyncio
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker
from app.database import Base, get_db
from app.main import app
from httpx import AsyncClient
from httpx import AsyncClient, ASGITransport
TEST_DATABASE_URL = "sqlite+aiosqlite:///:memory:"
@@ -28,6 +28,6 @@ async def client(db):
yield db
app.dependency_overrides[get_db] = override_get_db
async with AsyncClient(app=app, base_url="http://test") as ac:
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as ac:
yield ac
app.dependency_overrides.clear()