49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
"""Tests for config module"""
|
|
|
|
class TestConfig:
|
|
"""Tests for Config class"""
|
|
|
|
def test_config_singleton(self):
|
|
"""Should return same instance"""
|
|
from luxx.config import config, Config
|
|
config1 = Config()
|
|
config2 = Config()
|
|
assert config1 is config2
|
|
assert config is config1
|
|
|
|
def test_get_with_default(self):
|
|
"""Should return default value for missing key"""
|
|
from luxx.config import config
|
|
result = config.get("nonexistent.key", "default_value")
|
|
assert result == "default_value"
|
|
|
|
def test_get_nested_key(self):
|
|
"""Should support dot-separated keys"""
|
|
from luxx.config import config
|
|
# These should return configured or default values
|
|
secret = config.get("app.secret_key")
|
|
assert secret is not None
|
|
|
|
def test_properties_have_defaults(self):
|
|
"""All properties should have sensible defaults"""
|
|
from luxx.config import config
|
|
assert isinstance(config.debug, bool)
|
|
assert isinstance(config.app_host, str)
|
|
assert isinstance(config.app_port, int)
|
|
assert isinstance(config.database_url, str)
|
|
assert config.app_port == 8000
|
|
|
|
def test_tools_config_properties(self):
|
|
"""Tools configuration properties should work"""
|
|
from luxx.config import config
|
|
assert config.tools_enable_cache is not None
|
|
assert config.tools_cache_ttl > 0
|
|
assert config.tools_max_workers > 0
|
|
assert config.tools_max_iterations > 0
|
|
|
|
def test_llm_config_properties(self):
|
|
"""LLM configuration properties should work"""
|
|
from luxx.config import config
|
|
assert config.llm_provider is not None
|
|
assert config.llm_api_url is not None
|