TorbatYar/backend/services/identity-access/app/tests/conftest.py
Mortezakoohjani 800b0ba2c5 Deploy TorbatYar for torbatyar.ir with nginx multi-tenant routing.
Wire production domain, CORS for tenant subdomains, celery volume mounts, and nginx reverse proxy configs for apex, API, identity, auth, and wildcard tenants.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 21:43:33 +03:30

38 lines
1.0 KiB
Python

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