"""Tests for DealFlow AI configuration.""" from __future__ import annotations import os import sys from pathlib import Path import pytest sys.path.insert(0, str(Path(__file__).parent.parent)) class TestAppConfig: def test_defaults(self, monkeypatch): monkeypatch.delenv("LLM_BACKEND", raising=False) monkeypatch.delenv("VLLM_BASE_URL", raising=False) from src.config import AppConfig config = AppConfig() assert config.llm_backend.value == "vllm" assert "localhost" in config.vllm_base_url def test_backend_env_override(self, monkeypatch): monkeypatch.setenv("LLM_BACKEND", "hf") from importlib import reload import src.config as cfg_module reload(cfg_module) config = cfg_module.AppConfig() assert config.llm_backend.value == "hf" def test_serper_key_from_env(self, monkeypatch): monkeypatch.setenv("SERPER_API_KEY", "test-key-123") from src.config import AppConfig config = AppConfig() assert config.serper_api_key == "test-key-123"