Remove all authentication (login, sessions, bcrypt, itsdangerous) since the app runs on a private homelab LAN. Replace with a profile picker landing page and cookie-based profile selection (1-year expiry). - Add Alembic migration to drop password_hash/is_admin columns - Delete auth service, auth routes, login template, and auth tests - Rewrite app/utils/auth.py with NoProfileSelectedError and require_active_profile dependency - Add profile creation flow (GET/POST /profiles/create) - Rewrite home page as profile picker with card layout - Update all route files to use profile dependency instead of admin auth - Remove bcrypt and itsdangerous from requirements - Remove admin_username/admin_password from config - Update all tests for new profile-based access model Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
28 lines
1019 B
Python
28 lines
1019 B
Python
"""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
|