M8-R15: fix HA discovery identities and thermal totals
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user