31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from pytest import MonkeyPatch
|
|
|
|
from app.config import load_settings
|
|
|
|
|
|
def test_load_settings_reads_documented_environment(monkeypatch: MonkeyPatch) -> None:
|
|
monkeypatch.setenv("SILLYHOME_HA_URL", "http://ha.local:8123")
|
|
monkeypatch.setenv("SILLYHOME_HA_TOKEN", "secret")
|
|
monkeypatch.setenv("SILLYHOME_MODEL_STORE", "/tmp/models")
|
|
monkeypatch.setenv("SILLYHOME_AUTOMATION_STORE", "/tmp/automations")
|
|
monkeypatch.setenv("SILLYHOME_ACTUATOR_STORE", "/tmp/actuators")
|
|
monkeypatch.setenv("SILLYHOME_HISTORY_DAYS", "7")
|
|
monkeypatch.setenv("SILLYHOME_MIN_TRAINING_POINTS", "12")
|
|
monkeypatch.setenv("SILLYHOME_RETRAIN_STALE_HOURS", "48")
|
|
monkeypatch.setenv("SILLYHOME_RECONCILE_INTERVAL_SECONDS", "600")
|
|
|
|
settings = load_settings()
|
|
|
|
assert settings.ha_url == "http://ha.local:8123"
|
|
assert settings.ha_token == "secret"
|
|
assert settings.model_store == "/tmp/models"
|
|
assert settings.automation_store == "/tmp/automations"
|
|
assert settings.actuator_store == "/tmp/actuators"
|
|
assert settings.history_days == 7
|
|
assert settings.min_training_points == 12
|
|
assert settings.retrain_stale_hours == 48
|
|
assert settings.reconcile_interval_seconds == 600
|
|
assert settings.ha_configured
|