23 lines
740 B
Python
23 lines
740 B
Python
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
|