Release v1.6.0 dashboard architecture cleanup
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from time import perf_counter
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from pathlib import Path
|
||||
from time import perf_counter
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.api.v1.actuators import _deduplicate_actuator_ids
|
||||
from app.actuators.cache_db import DashboardCache
|
||||
from app.actuators.lifecycle import ActuatorReconciliationService
|
||||
from app.actuators.models import JobStatus, ModelSnapshot
|
||||
from app.actuators.store import ActuatorStore
|
||||
from app.behavior.engine import BehaviorEngine
|
||||
from app.config import Settings
|
||||
from app.api.v1.actuators import _deduplicate_actuator_ids
|
||||
from app.ha.discovery import DiscoveredEntity
|
||||
from app.ha.discovery import discover_entities
|
||||
from app.ha.history import (
|
||||
@@ -467,6 +468,30 @@ def test_dashboard_reports_performance_budget_and_anomalies(tmp_path: Path) -> N
|
||||
assert anomalies_response.json()
|
||||
|
||||
|
||||
def test_dashboard_system_and_start_do_not_materialize_entity_cache(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
with TestClient(app) as client:
|
||||
_install_service(tmp_path)
|
||||
client.get("/v1/actuators/discovery")
|
||||
client.post("/v1/actuators", json={"actuator_entity_id": "light.abstellkammer"})
|
||||
|
||||
def fail_full_payload(self: DashboardCache) -> dict[str, object]:
|
||||
raise AssertionError("full entity payload must not be loaded")
|
||||
|
||||
monkeypatch.setattr(DashboardCache, "load_entities_payload", fail_full_payload)
|
||||
|
||||
system_response = client.get("/v1/actuators/dashboard/system")
|
||||
start_response = client.get("/v1/actuators/dashboard/start")
|
||||
|
||||
assert system_response.status_code == 200
|
||||
assert system_response.json()["actuators"] == []
|
||||
assert system_response.json()["cache"]["entity_count"] == 4
|
||||
assert start_response.status_code == 200
|
||||
assert start_response.json()["actuators"][0]["friendly_name"] == "Abstellkammer Licht"
|
||||
|
||||
|
||||
def test_actuator_detail_uses_compact_payload(tmp_path: Path) -> None:
|
||||
with TestClient(app) as client:
|
||||
_install_service(tmp_path)
|
||||
|
||||
@@ -9,18 +9,18 @@ def test_dashboard_is_served_at_root() -> None:
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "SillyHome Next" in response.text
|
||||
assert "Arbeitsdashboard für gelernte Home-Assistant-Bedienung" in response.text
|
||||
assert "So gehst du vor" in response.text
|
||||
assert "Steuerung" in response.text
|
||||
assert "Entitätsname oder Gerät aus Home Assistant" in response.text
|
||||
assert "Oder aus Liste wählen" in response.text
|
||||
assert "Geräte, Lernen, Freigaben und Systemzustand" in response.text
|
||||
assert "So gehst du vor" not in response.text
|
||||
assert "Discovery & Einrichtung" in response.text
|
||||
assert "Entity-ID" in response.text
|
||||
assert "Geräteliste" in response.text
|
||||
assert "Liste durchsuchen" in response.text
|
||||
assert "Geräteliste bei Bedarf laden" in response.text
|
||||
assert "Vorschläge können Home Assistant stark abfragen" in response.text
|
||||
assert "Vorschläge können Home Assistant stark abfragen" not in response.text
|
||||
assert '<option value="detail">Details</option>' not in response.text
|
||||
assert "Wie gewohnt bedienen" in response.text
|
||||
assert "Ohne deine spätere Freigabe wird nichts geschaltet" in response.text
|
||||
assert "Du wählst keine Sensoren und erstellst keine Regeln" in response.text
|
||||
assert "Wie gewohnt bedienen" not in response.text
|
||||
assert "Ohne deine spätere Freigabe wird nichts geschaltet" not in response.text
|
||||
assert "Du wählst keine Sensoren und erstellst keine Regeln" not in response.text
|
||||
assert "Freigabestatus" in response.text
|
||||
assert "SillyHome übernehmen lassen" in response.text
|
||||
assert "Passende Home-Assistant-Automationen" in response.text
|
||||
@@ -29,10 +29,12 @@ def test_dashboard_is_served_at_root() -> None:
|
||||
assert "Aktuelle Situation auswerten" in response.text
|
||||
assert "Kontext selbst festlegen" in response.text
|
||||
assert "Entity-IDs manuell ergänzen" in response.text
|
||||
assert "Zurück zur Übersicht" in response.text
|
||||
assert "Anderes Gerät" in response.text
|
||||
assert "manual-context-freeform" in response.text
|
||||
assert "Diese Kontext-Auswahl speichern" in response.text
|
||||
assert "manual-context-select" in response.text
|
||||
assert "Die Prüfung simuliert keinen Sensorwechsel" in response.text
|
||||
assert "Die Prüfung simuliert keinen Sensorwechsel" not in response.text
|
||||
assert "Kein frischer passender Sensorwechsel erkannt" in response.text
|
||||
assert "Vorhersage jetzt prüfen" not in response.text
|
||||
assert "record.behavior.activation_ready" in response.text
|
||||
@@ -41,7 +43,7 @@ def test_dashboard_is_served_at_root() -> None:
|
||||
assert 'api("v1/actuators")' not in response.text
|
||||
assert 'api("v1/actuators/summary")' in response.text
|
||||
assert 'api("v1/entities")' not in response.text
|
||||
assert 'details class="collapsible"' in response.text
|
||||
assert 'details class="collapsible"' not in response.text
|
||||
assert 'class="group-panel"' in response.text
|
||||
assert "cachedDetailHtml" in response.text
|
||||
assert "refreshOverviewInBackground" in response.text
|
||||
|
||||
Reference in New Issue
Block a user