updated tests to work without .env file
This commit is contained in:
+4
-13
@@ -25,22 +25,13 @@ def test_settings_with_all_values():
|
||||
def test_settings_defaults():
|
||||
"""Test Settings uses defaults for optional values."""
|
||||
settings = Settings(
|
||||
anthropic_api_key="sk-ant-test" # Only required field
|
||||
anthropic_api_key="sk-ant-test", # Only required field
|
||||
_env_file=None,
|
||||
)
|
||||
|
||||
# Should use defaults
|
||||
assert settings.model == "claude-sonnet-4-5-20250929"
|
||||
assert settings.max_tokens == 8096
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_settings_missing_required_field():
|
||||
"""Test Settings raises error when required field is missing."""
|
||||
with pytest.raises(ValidationError) as exc_info:
|
||||
Settings(_env_file=None) # Missing anthropic_api_key
|
||||
|
||||
# Verify the error mentions the missing field
|
||||
assert "anthropic_api_key" in str(exc_info.value)
|
||||
assert settings.model == "claude-test-model"
|
||||
assert settings.max_tokens == 100
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
|
||||
Reference in New Issue
Block a user