diff --git a/git_commit_ai/tests/test_config.py b/git_commit_ai/tests/test_config.py new file mode 100644 index 0000000..dab1539 --- /dev/null +++ b/git_commit_ai/tests/test_config.py @@ -0,0 +1,22 @@ +import pytest +import os +import tempfile +from git_commit_ai.core.config import load_config + +def test_load_config_no_file(): + """Test loading config when no config file exists.""" + with tempfile.TemporaryDirectory() as tmpdir: + os.chdir(tmpdir) + config = load_config() + assert config == {} + +def test_load_config_with_file(): + """Test loading config from file.""" + with tempfile.TemporaryDirectory() as tmpdir: + os.chdir(tmpdir) + os.makedirs('.git-commit-ai') + with open('.git-commit-ai/config.yaml', 'w') as f: + f.write('model: llama3\nconventional: true') + config = load_config() + assert config['model'] == 'llama3' + assert config['conventional'] is True