Add secret management guide, client-side performance monitoring, and search accessibility enhancements

- Introduced a comprehensive Secret Management Guide detailing best practices, secret classification, development setup, production management, rotation procedures, and emergency protocols.
- Implemented a client-side performance monitoring script to track various metrics including page load performance, paint metrics, layout shifts, and memory usage.
- Enhanced search accessibility with keyboard navigation support for search results, ensuring compliance with WCAG standards and improving user experience.
This commit is contained in:
pacnpal
2025-12-23 16:41:42 -05:00
parent ae31e889d7
commit edcd8f2076
155 changed files with 22046 additions and 4645 deletions

View File

@@ -1,65 +1,113 @@
"""
Test settings for thrillwiki project.
This module extends base.py with test-specific configurations:
- Debug disabled for realistic testing
- PostGIS database for GeoDjango support
- In-memory cache for isolation
- Simplified password hashing for speed
- Disabled logging to reduce noise
"""
from .base import * # noqa: F403,F405
import os
from .base import * # noqa: F401,F403
# =============================================================================
# Test Core Settings
# =============================================================================
# Test-specific settings
DEBUG = False
# Use in-memory database for faster tests
# =============================================================================
# Test Database Configuration
# =============================================================================
# Use PostGIS for GeoDjango support - required for spatial queries in tests
DATABASES = {
"default": {
"ENGINE": "django.contrib.gis.db.backends.spatialite",
"NAME": ":memory:",
"ENGINE": "django.contrib.gis.db.backends.postgis",
"NAME": os.environ.get("TEST_DB_NAME", "test_thrillwiki"),
"USER": os.environ.get("TEST_DB_USER", "postgres"),
"PASSWORD": os.environ.get("TEST_DB_PASSWORD", "postgres"),
"HOST": os.environ.get("TEST_DB_HOST", "localhost"),
"PORT": os.environ.get("TEST_DB_PORT", "5432"),
"TEST": {
"NAME": os.environ.get("TEST_DB_NAME", "test_thrillwiki"),
},
}
}
# Use in-memory cache for tests
# =============================================================================
# Test Cache Configuration
# =============================================================================
# Use in-memory cache for test isolation
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
"LOCATION": "test-cache",
}
},
"sessions": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
"LOCATION": "test-sessions",
},
"api": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
"LOCATION": "test-api",
},
}
# Disable migrations for faster tests
# =============================================================================
# Email Configuration
# =============================================================================
# Use in-memory email backend for test assertions
class DisableMigrations:
def __contains__(self, item):
return True
def __getitem__(self, item):
return None
MIGRATION_MODULES = DisableMigrations()
# Email backend for tests
EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
# Password hashers for faster tests
# =============================================================================
# Password Hashing
# =============================================================================
# Use fast MD5 hashing for tests (never use in production!)
PASSWORD_HASHERS = [
"django.contrib.auth.hashers.MD5PasswordHasher",
]
# Disable logging during tests
# =============================================================================
# Logging Configuration
# =============================================================================
# Disable logging during tests to reduce noise
LOGGING_CONFIG = None
# Media files for tests
MEDIA_ROOT = BASE_DIR / "test_media"
# =============================================================================
# Static and Media Files
# =============================================================================
# Use test-specific directories
# Static files for tests
STATIC_ROOT = BASE_DIR / "test_static"
MEDIA_ROOT = BASE_DIR / "test_media" # noqa: F405
STATIC_ROOT = BASE_DIR / "test_static" # noqa: F405
# =============================================================================
# Security Settings
# =============================================================================
# Disable security features that interfere with testing
# Disable Turnstile for tests
TURNSTILE_SITE_KEY = "test-key"
TURNSTILE_SECRET_KEY = "test-secret"
# Test-specific middleware (remove caching middleware)
MIDDLEWARE = [m for m in MIDDLEWARE if "cache" not in m.lower()]
# =============================================================================
# Middleware Configuration
# =============================================================================
# Remove caching middleware for test isolation
MIDDLEWARE = [m for m in MIDDLEWARE if "cache" not in m.lower()] # noqa: F405
# =============================================================================
# Celery Configuration
# =============================================================================
# Run tasks synchronously during tests
# Celery settings for tests (if Celery is used)
CELERY_TASK_ALWAYS_EAGER = True
CELERY_TASK_EAGER_PROPAGATES = True