Files
gatehouse-api/config/testing.py
T
nexgen_mirrors 015c622016 test: add comprehensive integration test suite for IAM platform
Add 162 integration tests covering authentication flows, TOTP MFA,
SSH key/certificate management, organization workflows, multi-org
access, self-service features, admin operations, authorization,
security edge cases, department/principal management, CA management,
policy compliance, WebAuthn passkeys, and ZeroTier network access.

Includes:
- Reusable API client library with session management
- Test fixtures for users, organizations, memberships, and CAs
- Helper functions for SSH key generation and verification
- Documentation for running and writing tests

Also update test configuration to disable conflicting maas plugins
and configure WebAuthn/session settings for localhost testing.
2026-04-23 15:41:37 +09:30

43 lines
1.2 KiB
Python

"""Testing environment configuration."""
from config.base import BaseConfig
import os
class TestingConfig(BaseConfig):
"""Testing configuration."""
TESTING = True
DEBUG = True
# Explicitly set SECRET_KEY for testing
SECRET_KEY = os.getenv("SECRET_KEY", "test-secret-key-for-testing")
# CA key encryption — use a fixed test key so tests are deterministic
CA_ENCRYPTION_KEY = os.getenv("CA_ENCRYPTION_KEY", "test-ca-encryption-key-fixed-for-tests")
# Use in-memory SQLite for testing
SQLALCHEMY_DATABASE_URI = "sqlite:///:memory:"
SQLALCHEMY_ECHO = False
# Disable CSRF for testing
WTF_CSRF_ENABLED = False
# Fast password hashing for tests
BCRYPT_LOG_ROUNDS = 4
# Disable rate limiting in tests
RATELIMIT_ENABLED = False
# Use different Redis DB for testing
REDIS_URL = "redis://localhost:6379/15"
# Use filesystem for sessions in testing
SESSION_TYPE = "filesystem"
SESSION_FILE_DIR = "/tmp/flask_session_test"
# Override cookie domain so test_client on localhost can send cookies
SESSION_COOKIE_DOMAIN = None
WEBAUTHN_RP_ID = "localhost"
WEBAUTHN_ORIGIN = "http://localhost:8080"
FRONTEND_URL = "http://localhost:8080"