Files
shellgenius/tests/test_config.py
7000pctAUTO f74e9e3f5c
Some checks failed
CI / test (push) Has been cancelled
Fix test files to match implementation
2026-02-04 11:42:01 +00:00

38 lines
1.2 KiB
Python

"""Tests for configuration module."""
import tempfile
import os
from shellgenius.config import Config, get_config
class TestConfig:
def test_default_config(self):
"""Test default configuration values."""
with tempfile.NamedTemporaryFile(mode='w', suffix='.yaml', delete=False) as f:
f.write("")
f.flush()
config = Config(f.name)
assert config.get("ollama.host") == "localhost:11434"
assert config.get("ollama.model") == "llama3"
assert config.get("safety.level") == "moderate"
os.unlink(f.name)
def test_get_nested_value(self):
"""Test getting nested configuration values."""
config = Config()
assert config.get("ollama.host") is not None
assert config.get("nonexistent.key", "default") == "default"
def test_ollama_properties(self):
"""Test Ollama configuration properties."""
config = Config()
assert "localhost" in config.ollama_host
assert config.ollama_model in ["llama3", "codellama", "llama2", "mistral"]
assert config.safety_level in ["strict", "moderate", "permissive"]