Debashis
Initial commit: Security Incident Analyzer with LLM integration
0355450
raw
history blame contribute delete
970 Bytes
"""Tests for configuration."""
import pytest
from src.utils import Config, LLMProvider
def test_config_default_provider():
"""Test default provider is mock."""
cfg = Config()
assert cfg.llm_provider == LLMProvider.MOCK
def test_config_model_name():
"""Test model name selection."""
cfg = Config()
cfg.llm_provider = LLMProvider.OPENAI
assert "gpt" in cfg.model_name.lower()
cfg.llm_provider = LLMProvider.LOCAL
assert "mistral" in cfg.model_name.lower()
def test_config_validate_openai_missing_key():
"""Test validation fails for OpenAI without API key."""
cfg = Config()
cfg.llm_provider = LLMProvider.OPENAI
cfg.openai_api_key = None
with pytest.raises(ValueError, match="OPENAI_API_KEY"):
cfg.validate()
def test_config_validate_success():
"""Test validation passes with correct config."""
cfg = Config()
cfg.llm_provider = LLMProvider.MOCK
cfg.validate() # Should not raise