Fix HA websocket keepalive fallback

This commit is contained in:
2026-06-15 19:30:02 +02:00
parent 3140f65527
commit 9db7cde179
5 changed files with 23 additions and 6 deletions

View File

@@ -61,12 +61,16 @@ def test_ha_event_listener_processes_state_change(tmp_path: Path) -> None:
]
)
with patch("websockets.connect", return_value=fake_ws):
with patch("websockets.connect", return_value=fake_ws) as connect:
try:
await _ha_event_listener(mock_app, mock_client)
except asyncio.CancelledError:
pass
connect.assert_called_once_with(
"ws://homeassistant:8123/api/websocket",
ping_interval=None,
)
assert fake_ws.sent == [
{"type": "auth", "access_token": "test-token"},
{"id": 1, "type": "subscribe_events", "event_type": "state_changed"},