- conftest.py: set required env vars before app import to prevent Settings() crash
- gcs.py: lazy bucket init checks _bucket instead of _client; add @bucket.setter
- vtt.py: fix float precision in _format_timestamp; include empty-text cues in parser
- security.py: guard verify_password against empty hash (passlib UnknownHashError)
- tts.py: _parse_timestamp raises ValueError("Invalid timestamp format: …")
- emailer.py: HTML-escape job_title in _render_completion_template (XSS fix)
- test_emailer.py: rewrite for Mailgun-based service (replaced SendGrid)
- test_gcs.py: fix UploadFile constructor, MIME type, remove executor.submit mock
- test_gemini.py: patch module-level client instead of non-existent genai.upload_file;
translate_vtt tests use numbered-list mock responses matching new implementation
- test_tts.py: fix aiohttp async CM mock pattern; fix error message match
- test_models.py: update JobCreate to use source_is_english instead of language
- test_security.py: set jwt_access_ttl_min in token test
- test_cross_tenant_isolation.py: add patch to imports
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
18 lines
646 B
Python
18 lines
646 B
Python
import os
|
|
|
|
# Set required env vars before any app module is imported.
|
|
# Settings() is instantiated at module level in config.py, so these must
|
|
# be present before collection starts.
|
|
_TEST_DEFAULTS = {
|
|
"APP_ENV": "test",
|
|
"JWT_SECRET": "test-jwt-secret-at-least-32-chars-long",
|
|
"MONGODB_URI": "mongodb://localhost:27017/test_accessible_video",
|
|
"REDIS_URL": "redis://localhost:6379/1",
|
|
"GCP_PROJECT_ID": "test-gcp-project",
|
|
"GCS_BUCKET": "test-bucket",
|
|
"GEMINI_API_KEY": "test-gemini-key",
|
|
"CLIENT_BASE_URL": "http://localhost:3000",
|
|
}
|
|
|
|
for key, value in _TEST_DEFAULTS.items():
|
|
os.environ.setdefault(key, value)
|