M8-R15: fix HA discovery identities and thermal totals
frontend / frontend (push) Successful in 47s
pytest / test (push) Successful in 4m1s
docker-image / build-and-push (push) Successful in 1m38s

This commit is contained in:
2026-08-28 01:20:52 +02:00
parent 8180082f90
commit 018f13d73d
13 changed files with 1284 additions and 136 deletions
+29
View File
@@ -118,6 +118,35 @@ def test_app_start_seeds_missing_config_from_env_without_overwriting_existing_va
reset_db_caches()
def test_startup_initializes_fresh_legacy_discovery_cleanup_ledger(
tmp_path, monkeypatch: pytest.MonkeyPatch
) -> None:
"""The cleanup ledger exists before the expose UI can write its first toggle."""
import app.main as main
app_database_url = _prepare_app_db(tmp_path)
monkeypatch.setenv("APP_DATABASE_URL", app_database_url)
monkeypatch.setenv("AUTH_BOOTSTRAP_USERNAME", "admin")
monkeypatch.setenv("AUTH_BOOTSTRAP_PASSWORD", "test-password")
get_settings.cache_clear()
reset_db_caches()
main.ensure_auth_db_ready()
conn = sqlite3.connect(tmp_path / "app_ready.db")
try:
value = conn.execute(
"SELECT value FROM app_config WHERE key = ?",
("HA_DISCOVERY_LEGACY_THERMAL_CLEANUP_V1",),
).fetchone()[0]
finally:
conn.close()
assert value == '{"complete": true, "inventory": [], "topics": []}'
get_settings.cache_clear()
reset_db_caches()
def test_app_start_syncs_app_hostname_from_env_even_when_db_has_old_value(
tmp_path, monkeypatch: pytest.MonkeyPatch
) -> None: