From 5433c0a5355f3167309e4aa7a8baeb7488ccd6cf Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 17 May 2022 10:43:58 -0700 Subject: [PATCH] Make sure empty get_events results is always a list (#72021) --- homeassistant/components/logbook/__init__.py | 2 +- tests/components/logbook/test_init.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/logbook/__init__.py b/homeassistant/components/logbook/__init__.py index 35fa17bb3a4..549518e875a 100644 --- a/homeassistant/components/logbook/__init__.py +++ b/homeassistant/components/logbook/__init__.py @@ -271,7 +271,7 @@ async def ws_get_events( return if start_time > utc_now: - connection.send_result(msg["id"], {}) + connection.send_result(msg["id"], []) return entity_ids = msg.get("entity_ids") diff --git a/tests/components/logbook/test_init.py b/tests/components/logbook/test_init.py index ed95b4d10bc..dddbbc61134 100644 --- a/tests/components/logbook/test_init.py +++ b/tests/components/logbook/test_init.py @@ -2391,6 +2391,7 @@ async def test_get_events_future_start_time(hass, hass_ws_client, recorder_mock) assert response["id"] == 1 results = response["result"] + assert isinstance(results, list) assert len(results) == 0