File size: 1,131 Bytes
f6fdf6a
 
 
 
 
 
 
 
 
 
 
9db586c
f6fdf6a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9c71bb7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
from unittest.mock import patch

import pytest

from app.config import Settings


def test_settings_defaults():
    """Test that settings have correct default values."""
    settings = Settings()
    assert settings.model == "DragonLLM/Qwen-Open-Finance-R-8B"
    assert settings.service_api_key is None
    assert settings.log_level == "info"


def test_settings_from_env():
    """Test that settings can be loaded from environment variables."""
    with patch.dict(os.environ, {
        "MODEL": "custom-model",
        "SERVICE_API_KEY": "secret-key",
        "LOG_LEVEL": "debug"
    }):
        settings = Settings()
        assert settings.model == "custom-model"
        assert settings.service_api_key == "secret-key"
        assert settings.log_level == "debug"


def test_settings_env_file():
    """Test that settings can be loaded from .env file."""
    # This test assumes .env file exists with test values
    # In practice, you'd create a test .env file or mock the file reading
    settings = Settings()
    # Verify that the settings object can be instantiated
    assert isinstance(settings.model, str)