Fix HA websocket keepalive fallback
This commit is contained in:
@@ -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"},
|
||||
|
||||
Reference in New Issue
Block a user