"""Tests for the application configuration loader.""" import os from unittest.mock import patch from app.config import Settings, get_settings class TestSettings: """Tests for the Settings configuration class.""" def test_settings_loads_defaults(self) -> None: """Settings should have sensible defaults for all fields.""" # Remove DATABASE_URL so we test the actual default env_clean = {k: v for k, v in os.environ.items() if k != "DATABASE_URL"} with patch.dict(os.environ, env_clean, clear=True): settings = Settings() assert settings.app_env == "development" assert settings.app_host == "0.0.0.0" assert settings.app_port == 8000 assert settings.database_url == "sqlite:///data/sneakyswole.db" def test_get_settings_returns_singleton(self) -> None: """get_settings should return the same instance on repeated calls.""" s1 = get_settings() s2 = get_settings() assert s1 is s2