From 581b16e9fa95e4f3650ed351efd5bf250f51d4db Mon Sep 17 00:00:00 2001 From: etheralm <8655564+etheralm@users.noreply.github.com> Date: Wed, 1 May 2019 01:47:40 +0200 Subject: [PATCH] Fix failing state update tests (#23575) --- tests/components/dyson/test_air_quality.py | 7 +++++-- tests/components/dyson/test_fan.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/components/dyson/test_air_quality.py b/tests/components/dyson/test_air_quality.py index ab068823d64..1c7947fd621 100644 --- a/tests/components/dyson/test_air_quality.py +++ b/tests/components/dyson/test_air_quality.py @@ -86,8 +86,11 @@ async def test_purecool_aiq_update_state(devices, login, hass): device.environmental_state = \ DysonEnvironmentalSensorV2State(json.dumps(event)) - callback = device.add_message_listener.call_args_list[2][0][0] - callback(device.environmental_state) + for call in device.add_message_listener.call_args_list: + callback = call[0][0] + if type(callback.__self__) == dyson.DysonAirSensor: + callback(device.environmental_state) + await hass.async_block_till_done() fan_state = hass.states.get("air_quality.living_room") attributes = fan_state.attributes diff --git a/tests/components/dyson/test_fan.py b/tests/components/dyson/test_fan.py index 09622e4d36d..07c919c6e90 100644 --- a/tests/components/dyson/test_fan.py +++ b/tests/components/dyson/test_fan.py @@ -680,8 +680,11 @@ async def test_purecool_update_state(devices, login, hass): "osau": "0095", "ancp": "CUST"}} device.state = DysonPureCoolV2State(json.dumps(event)) - callback = device.add_message_listener.call_args_list[3][0][0] - callback(device.state) + for call in device.add_message_listener.call_args_list: + callback = call[0][0] + if type(callback.__self__) == dyson.DysonPureCoolDevice: + callback(device.state) + await hass.async_block_till_done() fan_state = hass.states.get("fan.living_room") attributes = fan_state.attributes