Files

45 lines
1.1 KiB
Python

"""test config"""
import pytest
from pydantic import ValidationError
from agent.config import Settings
@pytest.mark.unit
def test_settings_with_all_values():
"""Test Settings loads correctly with all values provided."""
settings = Settings(
anthropic_api_key="sk-ant-test",
model="claude-test",
max_tokens=8096,
safedir="/tmp/test",
)
assert settings.anthropic_api_key == "sk-ant-test"
assert settings.model == "claude-test"
assert settings.max_tokens == 8096
@pytest.mark.unit
def test_settings_defaults():
"""Test Settings uses defaults for optional values."""
settings = Settings(
anthropic_api_key="sk-ant-test", # Only required field
_env_file=None,
)
# Should use defaults
assert settings.model == "claude-test-model"
assert settings.max_tokens == 100
@pytest.mark.unit
def test_settings_type_validation():
"""Test Settings validates types correctly."""
with pytest.raises(ValidationError):
Settings(
anthropic_api_key="sk-ant-test",
max_tokens="not-a-number", # Should be int
)