Initial commit: site monorepo with API, web, and infra.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
влад
2026-07-16 10:11:54 +03:00
co-authored by Cursor
commit 016910ffb7
447 changed files with 73972 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
import os
import tempfile
from pathlib import Path
# Pytest must not pick up Docker install.env (postgresql@postgres) from the repo.
_test_secrets = Path(tempfile.mkdtemp(prefix="compton-pytest-secrets-"))
os.environ["COMPTON_INSTALL_SECRETS_DIR"] = str(_test_secrets)
os.environ["DATABASE_URL"] = "sqlite+pysqlite:///:memory:"
os.environ.setdefault("EMAIL_DELIVERY_MODE", "memory")
from fastapi.testclient import TestClient
import pytest
from app.core import database as db_module
from app.core.email import memory_mailer
from app.core.storage import memory_store
from app.db.base import Base
from app.db.seed import run_seed
from app.main import app
@pytest.fixture(scope="session", autouse=True)
def setup_database():
Base.metadata.create_all(db_module.engine)
run_seed(include_demo_pages=False)
yield
Base.metadata.drop_all(db_module.engine)
@pytest.fixture(autouse=True)
def disable_rate_limits(monkeypatch):
from app.core.config import settings
monkeypatch.setattr(settings, "enable_rate_limit", False)
monkeypatch.setattr(settings, "email_delivery_mode", "memory")
monkeypatch.setattr(settings, "storage_mode", "memory")
@pytest.fixture(autouse=True)
def clear_email_outbox():
memory_mailer.clear()
yield
memory_mailer.clear()
@pytest.fixture(autouse=True)
def clear_storage():
memory_store.clear()
yield
memory_store.clear()
@pytest.fixture()
def client() -> TestClient:
return TestClient(app)