From 7ea79148bae36f7b1a92c60333600b4aa4fbfa40 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 10 Mar 2024 13:13:26 -1000 Subject: [PATCH] Ignore logging events in zha websocket tests (#113031) --- tests/components/zha/test_websocket_api.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/components/zha/test_websocket_api.py b/tests/components/zha/test_websocket_api.py index 4bd6540f411..041329123f8 100644 --- a/tests/components/zha/test_websocket_api.py +++ b/tests/components/zha/test_websocket_api.py @@ -704,7 +704,13 @@ async def test_ws_permit_with_qr_code( {ID: 14, TYPE: f"{DOMAIN}/devices/{SERVICE_PERMIT}", **params} ) - msg = await zha_client.receive_json() + msg_type = None + while msg_type != const.TYPE_RESULT: + # There will be logging events coming over the websocket + # as well so we want to ignore those + msg = await zha_client.receive_json() + msg_type = msg["type"] + assert msg["id"] == 14 assert msg["type"] == const.TYPE_RESULT assert msg["success"] @@ -761,7 +767,13 @@ async def test_ws_permit_ha12( {ID: 14, TYPE: f"{DOMAIN}/devices/{SERVICE_PERMIT}", **params} ) - msg = await zha_client.receive_json() + msg_type = None + while msg_type != const.TYPE_RESULT: + # There will be logging events coming over the websocket + # as well so we want to ignore those + msg = await zha_client.receive_json() + msg_type = msg["type"] + assert msg["id"] == 14 assert msg["type"] == const.TYPE_RESULT assert msg["success"]