52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
|
|
from src.config import Config, ConfigLoader
|
|
|
|
|
|
class TestConfig:
|
|
def test_default_config(self):
|
|
config = Config()
|
|
assert config.llm.endpoint == "http://localhost:11434"
|
|
assert config.llm.model == "codellama"
|
|
assert config.review.strictness == "balanced"
|
|
assert config.hooks.enabled is True
|
|
|
|
def test_config_from_dict(self):
|
|
data = {
|
|
"llm": {
|
|
"endpoint": "http://custom:9000",
|
|
"model": "custom-model"
|
|
},
|
|
"review": {
|
|
"strictness": "strict"
|
|
}
|
|
}
|
|
config = Config(**data)
|
|
assert config.llm.endpoint == "http://custom:9000"
|
|
assert config.llm.model == "custom-model"
|
|
assert config.review.strictness == "strict"
|
|
|
|
def test_language_config(self):
|
|
config = Config()
|
|
py_config = config.languages.get_language_config("python")
|
|
assert py_config is not None
|
|
assert py_config.enabled is True
|
|
|
|
def test_strictness_profiles(self):
|
|
config = Config()
|
|
permissive = config.strictness_profiles.get_profile("permissive")
|
|
assert permissive.check_style is False
|
|
strict = config.strictness_profiles.get_profile("strict")
|
|
assert strict.check_performance is True
|
|
|
|
|
|
class TestConfigLoader:
|
|
def test_load_default_config(self):
|
|
loader = ConfigLoader()
|
|
config = loader.load()
|
|
assert isinstance(config, Config)
|
|
|
|
def test_find_config_files_nonexistent(self):
|
|
loader = ConfigLoader("/nonexistent/path.yaml")
|
|
path, _global_path = loader.find_config_files()
|
|
assert path is None
|