- Optional OPENAI_BASE_URL for OpenAI-compatible endpoints or proxies - Tests run the real openai SDK against a local stub server: request shape (model, auth, strict json_schema), text cleanup, photo import and an authentication error mapped to the UI message Co-Authored-By: Claude Opus 5.5 <[email protected]>
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Test settings: same as production, with defaults for required variables."""
|
|
|
|
import os
|
|
|
|
os.environ.setdefault("SECRET_KEY", "test-secret-key-not-for-production")
|
|
os.environ.setdefault("APP_BASE_URL", "https://kochbuch.example.test")
|
|
|
|
from .settings import * # noqa: E402,F403
|
|
|
|
STORAGES = {
|
|
**STORAGES, # noqa: F405
|
|
"staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"},
|
|
}
|
|
|
|
# Static files are served by the finders in tests; no collectstatic needed.
|
|
WHITENOISE_USE_FINDERS = True
|
|
WHITENOISE_AUTOREFRESH = True
|
|
|
|
# Deterministic defaults, independent of a real .env (the Docker test service loads it).
|
|
import ipaddress # noqa: E402
|
|
|
|
OPENAI_API_KEY = ""
|
|
OPENAI_MODEL = "gpt-5-mini"
|
|
OPENAI_REASONING_EFFORT = "low"
|
|
OPENAI_BASE_URL = ""
|
|
AI_RATE_LIMIT_PER_USER_PER_DAY = 0
|
|
AI_RATE_LIMIT_GLOBAL_PER_DAY = 0
|
|
COMMENT_RATE_LIMIT_PER_HOUR = 30
|
|
LOGIN_MAX_FAILURES_PER_EMAIL = 5
|
|
LOGIN_MAX_FAILURES_PER_IP = 30
|
|
LOGIN_LOCKOUT_MINUTES = 15
|
|
IMAGE_MAX_UPLOAD_MB = 15
|
|
IMAGE_MAX_PER_RECIPE = 10
|
|
CLIENT_IP_HEADER = ""
|
|
TRUSTED_PROXIES = [ipaddress.ip_network(n) for n in ("127.0.0.0/8", "::1/128", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16")]
|