18 lines
493 B
Python
18 lines
493 B
Python
import pytest
|
|
from pydantic import ValidationError
|
|
|
|
from app.config import Settings
|
|
|
|
|
|
def test_environment_settings(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
monkeypatch.setenv("MONITOR_PORT", "9000")
|
|
monkeypatch.setenv("MONITOR_MAX_REDIRECTS", "2")
|
|
settings = Settings()
|
|
assert settings.port == 9000
|
|
assert settings.max_redirects == 2
|
|
|
|
|
|
def test_invalid_settings_are_rejected() -> None:
|
|
with pytest.raises(ValidationError):
|
|
Settings(connect_timeout_seconds=0)
|