import os os.environ["ENVIRONMENT"] = "test" os.environ["AUTH_REQUIRED"] = "false" os.environ["DATABASE_URL"] = "sqlite+aiosqlite:///./test_identity.db" os.environ["DATABASE_URL_SYNC"] = "sqlite:///./test_identity.db" os.environ["JWT_VERIFY_SIGNATURE"] = "false" os.environ["KEYCLOAK_ENABLED"] = "false" import pytest_asyncio from httpx import ASGITransport, AsyncClient import app.models # noqa from app.core.database import AsyncSessionLocal, Base, engine from app.main import app @pytest_asyncio.fixture async def db_setup(): async with engine.begin() as conn: await conn.run_sync(Base.metadata.create_all) yield async with engine.begin() as conn: await conn.run_sync(Base.metadata.drop_all) @pytest_asyncio.fixture async def client(db_setup): transport = ASGITransport(app=app) async with AsyncClient(transport=transport, base_url="http://testserver") as ac: yield ac @pytest_asyncio.fixture async def session(db_setup): async with AsyncSessionLocal() as s: yield s