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)
|
||||
|
||||
Reference in New Issue
Block a user