diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index fa586ef..071bfb6 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -19,7 +19,6 @@ jobs: POSTGRES_DB: github_actions ports: - 5432:5432 - # Add health check to ensure postgres is ready options: >- --health-cmd pg_isready --health-interval 10s @@ -37,11 +36,16 @@ jobs: - name: Install Dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install -r requirements/dev.txt + + - name: Create Recovery Key + run: | + python -c "from cryptography.fernet import Fernet; key = Fernet.generate_key(); open('recovery_key.key', 'wb').write(key)" - name: Run Tests env: DATABASE_URL: postgres://postgres:postgres@localhost:5432/github_actions - DJANGO_SETTINGS_MODULE: thebluelist.settings.test + DJANGO_SETTINGS_MODULE: config.settings.test + SECRET_KEY: your-test-secret-key-here run: | - python manage.py test \ No newline at end of file + python manage.py test -v 2 \ No newline at end of file diff --git a/config/settings/test.py b/config/settings/test.py index cef2042..d15149d 100644 --- a/config/settings/test.py +++ b/config/settings/test.py @@ -1,7 +1,7 @@ -import os -import dj_database_url from .base import * +DEBUG = False + DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', @@ -13,24 +13,12 @@ } } -# Make sure all required apps are included -INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'users', -] - -# Test-specific settings -DEBUG = False +# Test specific settings EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend' +PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher'] -# Disable any expensive/unnecessary settings during testing -PASSWORD_HASHERS = [ - 'django.contrib.auth.hashers.MD5PasswordHasher', -] +# Disable any resource-intensive settings +MAX_ACCOUNTS_PER_EMAIL = 2 # If you use this setting -# Add any other test-specific settings \ No newline at end of file +# Override any settings that require external services +MAILTRAP_API_TOKEN = 'dummy-token-for-testing' \ No newline at end of file