Files
maskanx_crm_backend/tests/test_config.py
T
AFFAANhandClaude Opus 5 f6a54d6f93 Initial commit: Maskan CRM backend
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>
2026-08-01 10:28:41 +05:30

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()