- infrasynth.configs: typed multi-tenant config store (registry, service, secrets, cache) + public config_changed/config_reset signals and API - emit the declared-but-dead signals (features flags/overrides, scheduler task_completed/task_failed, tenancy tenant_updated, audit model_changed) and per-model audit field exclusions - security: permission catalog (security_permission), Django-style model-derived AutoPermission, PermissionRegistry, RoleAssignment, global-or-tenant Grant/Revoke, catalog API - consolidate the permission surface: PermissionRegistry only (drop the settings dict), IsAuthenticatedAndPermitted aliases HybridPermission, require_permission replaced by required_permissions + require_all - packaging: add [build-system]; add Forgejo publish workflow (.forgejo)
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
import tempfile
|
|
from pathlib import Path
|
|
|
|
from .base import * # noqa: F403
|
|
|
|
SECRET_KEY = "test-secret-key"
|
|
|
|
# Keep every test artifact out of the repo tree.
|
|
MEDIA_ROOT = Path(tempfile.mkdtemp(prefix="infrasynth-test-media-"))
|
|
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.sqlite3",
|
|
"NAME": ":memory:",
|
|
},
|
|
}
|
|
|
|
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
|
|
|
|
CELERY_TASK_ALWAYS_EAGER = True
|
|
CELERY_TASK_EAGER_PROPAGATES = True
|
|
|
|
CACHES = {
|
|
"default": {
|
|
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
|
|
},
|
|
}
|
|
|
|
INFRASYNTH_SECURITY["CRYPTO_KEY"] = "sBptcnWgrG5Tp8MJCnSoGQzZLb_4QPwNjuM4QNTGWe4="
|
|
INFRASYNTH_SECURITY["COOKIE_SECURE"] = False
|
|
|
|
INFRASYNTH_AUDIT["STORE_IN_DB"] = True
|
|
|
|
# Tests default to the pre-envelope wire format so the bulk of the suite asserts
|
|
# on raw payloads; tests/test_api enables the envelope/cursor layer explicitly.
|
|
REST_FRAMEWORK = {
|
|
"DEFAULT_AUTHENTICATION_CLASSES": [
|
|
"infrasynth.security.auth.cookies.CookieJWTAuthentication",
|
|
"infrasynth.security.auth.api_keys.APIKeyAuthentication",
|
|
],
|
|
"DEFAULT_PERMISSION_CLASSES": [
|
|
"rest_framework.permissions.IsAuthenticated",
|
|
"infrasynth.security.permissions.AutoPermission",
|
|
],
|
|
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
|
|
"PAGE_SIZE": 25,
|
|
"DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"],
|
|
}
|
|
|
|
# The tenant middleware is exercised by dedicated tests via override_settings.
|
|
INFRASYNTH_TENANCY["ENABLED"] = False
|
|
INFRASYNTH_TENANCY["REQUIRE_TENANT_BY_DEFAULT"] = False
|