Independent FastAPI backend for Maskan CRM. Owns contacts, organizations, leads, pipelines, activities, products, quotes, users, permissions, audit records and first-party integration credentials, with Alembic migrations against PostgreSQL. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
31 lines
775 B
Python
31 lines
775 B
Python
import pytest
|
|
|
|
from app.core.config import Settings
|
|
|
|
|
|
def test_postgres_is_the_default_runtime_database() -> None:
|
|
settings = Settings(_env_file=None)
|
|
|
|
assert settings.database_url.startswith("postgresql+psycopg://")
|
|
|
|
|
|
def test_sqlite_is_rejected_outside_tests() -> None:
|
|
settings = Settings(
|
|
_env_file=None,
|
|
MASKAN_CRM_ENV="development",
|
|
DATABASE_URL="sqlite+pysqlite:///crm.db",
|
|
)
|
|
|
|
with pytest.raises(RuntimeError, match="requires PostgreSQL"):
|
|
settings.validate_database_backend()
|
|
|
|
|
|
def test_sqlite_is_allowed_for_automated_tests_only() -> None:
|
|
settings = Settings(
|
|
_env_file=None,
|
|
MASKAN_CRM_ENV="testing",
|
|
DATABASE_URL="sqlite+pysqlite://",
|
|
)
|
|
|
|
settings.validate_database_backend()
|