Files
stundenfuchs/tests/conftest.py
T
maddin 9794362f39
CI / checks (push) Has been cancelled
chore: initialize public repository
2026-03-22 12:55:55 +00:00

31 lines
694 B
Python

from pathlib import Path
import sys
import pytest
ROOT_DIR = Path(__file__).resolve().parents[1]
if str(ROOT_DIR) not in sys.path:
sys.path.insert(0, str(ROOT_DIR))
from app.config import Settings
from app.main import create_app
def make_settings(db_url: str) -> Settings:
return Settings(
APP_ENV="test",
DB_URL=db_url,
SESSION_SECRET="test-secret",
COOKIE_SECURE=False,
COOKIE_SAMESITE="lax",
LOGIN_RATE_LIMIT_ATTEMPTS=5,
LOGIN_RATE_LIMIT_WINDOW_MINUTES=15,
)
@pytest.fixture()
def app(tmp_path):
db_path = tmp_path / "test.db"
settings = make_settings(f"sqlite:///{db_path}")
return create_app(settings)