Files
HomeOS/tests/test_config.py
2026-03-29 21:26:00 +08:00

17 lines
424 B
Python

import os
from mqtt_home.config import Settings
def test_default_settings():
s = Settings()
assert s.mqtt_host == "localhost"
assert s.mqtt_port == 1883
assert s.web_port == 8000
def test_settings_from_env(monkeypatch):
monkeypatch.setenv("MQTT_HOST", "192.168.1.1")
monkeypatch.setenv("MQTT_PORT", "1884")
s = Settings()
assert s.mqtt_host == "192.168.1.1"
assert s.mqtt_port == 1884