This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
"""Tests for configuration module."""
|
||||
|
||||
import pytest
|
||||
import tempfile
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from shellgenius.config import Config, get_config
|
||||
|
||||
@@ -18,7 +16,7 @@ class TestConfig:
|
||||
config = Config(f.name)
|
||||
|
||||
assert config.get("ollama.host") == "localhost:11434"
|
||||
assert config.get("ollama.model") == "codellama"
|
||||
assert config.get("ollama.model") == "llama3"
|
||||
assert config.get("safety.level") == "moderate"
|
||||
|
||||
os.unlink(f.name)
|
||||
@@ -30,19 +28,10 @@ class TestConfig:
|
||||
assert config.get("ollama.host") is not None
|
||||
assert config.get("nonexistent.key", "default") == "default"
|
||||
|
||||
def test_environment_override(self):
|
||||
"""Test environment variable overrides."""
|
||||
os.environ["OLLAMA_MODEL"] = "custom-model"
|
||||
|
||||
config = Config()
|
||||
assert config.ollama_model == "custom-model"
|
||||
|
||||
del os.environ["OLLAMA_MODEL"]
|
||||
|
||||
def test_ollama_properties(self):
|
||||
"""Test Ollama configuration properties."""
|
||||
config = Config()
|
||||
|
||||
assert "localhost" in config.ollama_host
|
||||
assert config.ollama_model in ["codellama", "llama2", "mistral"]
|
||||
assert config.ollama_model in ["llama3", "codellama", "llama2", "mistral"]
|
||||
assert config.safety_level in ["strict", "moderate", "permissive"]
|
||||
|
||||
Reference in New Issue
Block a user