| 1 | from app.settings import Settings |
| 2 | |
| 3 | |
| 4 | def test_local_profile_loads_without_azure_or_secrets() -> None: |
| 5 | settings = Settings(_env_file=None, environment="LOCAL") |
| 6 | assert settings.environment == "LOCAL" |
| 7 | assert settings.research_database_ssl_mode == "disable" |
| 8 | assert settings.research_database_password is None |
| 9 | assert settings.research_distributed_lock_backend == "process" |
| 10 | |
| 11 | |
| 12 | def test_azure_profile_accepts_secure_external_postgres_without_embedded_secret() -> None: |
| 13 | settings = Settings( |
| 14 | _env_file=None, |
| 15 | environment="AZURE", |
| 16 | research_database_host="postgres.example.invalid", |
| 17 | research_database_ssl_mode="verify-full", |
| 18 | research_database_connect_timeout_seconds=10, |
| 19 | research_database_statement_timeout_seconds=30, |
| 20 | ) |
| 21 | assert settings.environment == "AZURE" |
| 22 | assert settings.research_database_ssl_mode == "verify-full" |
| 23 | assert settings.research_database_password is None |
| 24 | |
| 25 | |
| 26 | def test_provider_endpoints_and_lock_backend_are_environment_configurable() -> None: |
| 27 | settings = Settings( |
| 28 | _env_file=None, |
| 29 | yahoo_search_url="https://market.example.invalid/search", |
| 30 | nse_announcements_url="https://exchange.example.invalid/announcements", |
| 31 | research_distributed_lock_backend="postgres", |
| 32 | ) |
| 33 | assert settings.yahoo_search_url == "https://market.example.invalid/search" |
| 34 | assert settings.nse_announcements_url == "https://exchange.example.invalid/announcements" |
| 35 | assert settings.research_distributed_lock_backend == "postgres" |