From 5ac0cb60a5c3cccbc7b469864d8a87c8506c4afd Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Thu, 5 Feb 2026 06:34:49 +0000 Subject: [PATCH] Initial upload: Local AI Commit Reviewer CLI with CI/CD workflow --- tests/unit/test_config.py | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tests/unit/test_config.py diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py new file mode 100644 index 0000000..8dddac4 --- /dev/null +++ b/tests/unit/test_config.py @@ -0,0 +1,55 @@ +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