From 24428d98a1a08f8e3cec3cc086c67eb7d4c5c0cd Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 21 Apr 2023 18:58:07 +0200 Subject: [PATCH] Fix lingering timer in smartthings tests (#91697) --- tests/components/smartthings/test_init.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/components/smartthings/test_init.py b/tests/components/smartthings/test_init.py index a9989787517..f08d1b54985 100644 --- a/tests/components/smartthings/test_init.py +++ b/tests/components/smartthings/test_init.py @@ -179,7 +179,7 @@ async def test_scenes_unauthorized_loads_platforms( smartthings_mock.subscriptions.return_value = subscriptions with patch.object(hass.config_entries, "async_forward_entry_setup") as forward_mock: - assert await smartthings.async_setup_entry(hass, config_entry) + assert await hass.config_entries.async_setup(config_entry.entry_id) # Assert platforms loaded await hass.async_block_till_done() assert forward_mock.call_count == len(PLATFORMS) @@ -211,7 +211,7 @@ async def test_config_entry_loads_platforms( smartthings_mock.subscriptions.return_value = subscriptions with patch.object(hass.config_entries, "async_forward_entry_setup") as forward_mock: - assert await smartthings.async_setup_entry(hass, config_entry) + assert await hass.config_entries.async_setup(config_entry.entry_id) # Assert platforms loaded await hass.async_block_till_done() assert forward_mock.call_count == len(PLATFORMS) @@ -243,7 +243,7 @@ async def test_config_entry_loads_unconnected_cloud( ] smartthings_mock.subscriptions.return_value = subscriptions with patch.object(hass.config_entries, "async_forward_entry_setup") as forward_mock: - assert await smartthings.async_setup_entry(hass, config_entry) + assert await hass.config_entries.async_setup(config_entry.entry_id) await hass.async_block_till_done() assert forward_mock.call_count == len(PLATFORMS) @@ -480,6 +480,8 @@ async def test_event_handler_dispatches_updated_devices( assert devices[3].status.attributes["lock"].value == "locked" assert devices[3].status.attributes["lock"].data == {"codeId": "1"} + broker.disconnect() + async def test_event_handler_ignores_other_installed_app( hass: HomeAssistant, config_entry, device_factory, event_request_factory @@ -502,6 +504,8 @@ async def test_event_handler_ignores_other_installed_app( assert not called + broker.disconnect() + async def test_event_handler_fires_button_events( hass: HomeAssistant, @@ -542,3 +546,5 @@ async def test_event_handler_fires_button_events( await hass.async_block_till_done() assert called + + broker.disconnect()