Files
life-echo/api/tests/test_app_config_loader.py

34 lines
1017 B
Python
Raw Permalink Normal View History

"""TOML configuration loader tests."""
from pathlib import Path
import pytest
from app.core.app_config_loader import load_app_config
FIXTURES = Path(__file__).resolve().parent / "fixtures" / "config"
def test_load_default_only() -> None:
cfg = load_app_config("development", config_dir=FIXTURES / "minimal")
assert cfg.chat.interview_persona == "default"
assert cfg.deploy.enable_tts is True
def test_staging_overlay_merges_chat_section() -> None:
cfg = load_app_config("staging", config_dir=FIXTURES / "merge")
assert cfg.chat.interview_persona == "staging_persona"
assert cfg.chat.interview_temperature == 0.93
assert cfg.deploy.mock_sms_login_enabled is True
def test_unknown_top_level_key_rejected(tmp_path: Path) -> None:
bad = tmp_path / "default.toml"
bad.write_text(
'[deploy]\nenable_tts = true\n\n[typo_section]\nfoo = 1\n',
encoding="utf-8",
)
with pytest.raises(Exception):
load_app_config("development", config_dir=tmp_path)