system-prompts-and-models-o.../salesflow-saas/backend/tests/conftest.py
Sami Assiri 07557c4be9 feat(dealix): GTM polish, CRM/AI APIs, launch verification hardening
- Add integrations CRM and AI routing APIs; Salesforce OAuth refresh; lead CRM metadata
- Marketer hub, settings CRM UI, OS views; premium landing and strategy_summary differentiators
- Docs: API-MAP, product guide, competitive matrix, launch simulation, AGENT-MAP LLM routing
- Sync script: strategy legal + competitive matrix to public; pytest DB isolation (.pytest_dealix.sqlite)
- Tests: CRM status and AI routing smoke; check_go_live_gate UTF-8 stdout on Windows
- Alembic migrations for strategic deal links and lead company/sector/city

Made-with: Cursor
2026-04-13 05:08:39 +03:00

35 lines
958 B
Python

import asyncio
import os
from pathlib import Path
# JWT-based API tests require this gate to be off (production may set .env).
os.environ["DEALIX_INTERNAL_API_TOKEN"] = ""
# Fresh SQLite schema per pytest session — avoids stale ./dealix.db missing new columns.
_backend_root = Path(__file__).resolve().parent.parent
_test_sqlite = _backend_root / ".pytest_dealix.sqlite"
try:
_test_sqlite.unlink(missing_ok=True)
except OSError:
pass
os.environ["DATABASE_URL"] = "sqlite+aiosqlite:///" + _test_sqlite.resolve().as_posix()
import pytest
import pytest_asyncio
from httpx import AsyncClient, ASGITransport
from app.main import app
@pytest.fixture(scope="session", autouse=True)
def _init_database():
from app.database import init_db
asyncio.run(init_db())
@pytest_asyncio.fixture
async def client():
transport = ASGITransport(app=app)
async with AsyncClient(transport=transport, base_url="http://test") as ac:
yield ac