File size: 1,282 Bytes
c05de71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
"""
Tests for the config module.
"""
import unittest
import os
from unittest.mock import patch

# Import the module to test
import config

class TestConfig(unittest.TestCase):
    """Test cases for the config module."""
    
    def test_get_chatbot_config(self):
        """Test that get_chatbot_config returns expected values."""
        # Call the function
        result = config.get_chatbot_config()
        
        # Check the result
        self.assertIsInstance(result, dict)
        self.assertIn('model', result)
        self.assertIn('temperature', result)
        self.assertIn('max_tokens', result)
        self.assertIn('embedding_model', result)
        
    @patch.dict(os.environ, {"LLM_MODEL": "test-model"})
    def test_environment_override(self):
        """Test that environment variables override defaults."""
        # Force reload of the config module
        import importlib
        importlib.reload(config)
        
        # Check that the environment variable was used
        self.assertEqual(config.LLM_MODEL, "test-model")
        
        # Check that the config dict contains the override
        result = config.get_chatbot_config()
        self.assertEqual(result['model'], "test-model")
        
if __name__ == '__main__':
    unittest.main()