Files
local-ai-commit-reviewer/tests/unit/test_config.py
7000pctAUTO 5ac0cb60a5
Some checks failed
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
Initial upload: Local AI Commit Reviewer CLI with CI/CD workflow
2026-02-05 06:34:49 +00:00

56 lines
1.7 KiB
Python

import pytest
from pathlib import Path
import tempfile
import os
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