Initial public release

This commit is contained in:
ajp_anton
2026-05-30 15:44:40 +00:00
commit cc4e0c2c0f
56 changed files with 11840 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
from __future__ import annotations
from ha_deconz_bridge.settings import Settings
def test_from_env_uses_dataclass_defaults(monkeypatch) -> None:
monkeypatch.delenv("HA_DECONZ_BRIDGE_DECONZ_RETRY_TIMEOUT", raising=False)
monkeypatch.delenv("HA_DECONZ_BRIDGE_MQTT_HOST", raising=False)
monkeypatch.delenv("HA_DECONZ_BRIDGE_TARGET_CACHE_SCALE", raising=False)
monkeypatch.delenv("HOME_LIGHTS_DECONZ_RETRY_TIMEOUT", raising=False)
monkeypatch.delenv("HOME_LIGHTS_MQTT_HOST", raising=False)
monkeypatch.delenv("HOME_LIGHTS_TARGET_CACHE_SCALE", raising=False)
settings = Settings.from_env()
assert settings.mqtt_host == "homeassistant"
assert settings.deconz_retry_timeout == 2.0
assert settings.target_cache_scale == 10000
def test_from_env_reads_target_cache_scale(monkeypatch) -> None:
monkeypatch.setenv("HA_DECONZ_BRIDGE_TARGET_CACHE_SCALE", "750")
settings = Settings.from_env()
assert settings.target_cache_scale == 750
def test_from_env_reads_warmup_flag(monkeypatch) -> None:
monkeypatch.setenv("HA_DECONZ_BRIDGE_WARMUP_ON_STARTUP", "false")
settings = Settings.from_env()
assert settings.warmup_on_startup is False
def test_from_env_keeps_legacy_prefix_fallback(monkeypatch) -> None:
monkeypatch.delenv("HA_DECONZ_BRIDGE_MQTT_HOST", raising=False)
monkeypatch.setenv("HOME_LIGHTS_MQTT_HOST", "legacy-host")
settings = Settings.from_env()
assert settings.mqtt_host == "legacy-host"