Close the gaps between the documented contract (API-STANDARD, TENANCY, ENTITLEMENTS) and the implementation, and remove committed build artifacts. Security: - verify + process inbound webhooks (HMAC/handler verify, size limit, timestamp tolerance, idempotency via InboundEvent.external_id) - real 2FA login flow (pre-auth challenge; tokens only after verify/recovery) - wire HybridPermission into security/audit views; add API-key rotate and users/<id>/permissions|roles endpoints - tenant-scoped throttling on by default; webhook replay protection - verify MercadoPago webhook signatures - login brute-force guard, configurable password policy, real ALTCHA PoW Correctness: - apply verified billing webhooks idempotently (subscription/entitlement/ invoice/PaymentTransaction); scheduled payment lifecycle jobs - capture audit update diffs automatically; add audit retention purge - working notification retries, per-channel rate limits, log retention - pluggable virus scanner, upload-size limit, pipeline toggle - feature rollout %/environment targeting; settings-driven registrations - workflow guards (instance cap, route depth, self-assignment, clone on re-entry) - wire every previously-dead INFRASYNTH_* setting; drop truly dead ones Delivery: - README + CHANGELOG; CI format check + coverage gate - keep test media out of the tree; untrack .coverage, __pycache__, egg-info, docs/ and invoice artifacts
51 lines
1.5 KiB
Python
51 lines
1.5 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",
|
|
],
|
|
"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
|