From b507fb1e06e7912cc80723cd7d1917196383b591 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 24 Jan 2023 11:30:28 -1000 Subject: [PATCH] Migrate steam_online to use async_forward_entry_setups (#86578) * Migrate steam_online to use async_forward_entry_setups Replaces deprecated async_setup_platforms with async_forward_entry_setups * fix steam_online tests --- homeassistant/components/steam_online/__init__.py | 2 +- tests/components/steam_online/test_config_flow.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/steam_online/__init__.py b/homeassistant/components/steam_online/__init__.py index b1697e3b794..2629962565b 100644 --- a/homeassistant/components/steam_online/__init__.py +++ b/homeassistant/components/steam_online/__init__.py @@ -37,7 +37,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: coordinator = SteamDataUpdateCoordinator(hass) await coordinator.async_config_entry_first_refresh() hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator - hass.config_entries.async_setup_platforms(entry, PLATFORMS) + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) return True diff --git a/tests/components/steam_online/test_config_flow.py b/tests/components/steam_online/test_config_flow.py index 1844611530d..a9d81a16fba 100644 --- a/tests/components/steam_online/test_config_flow.py +++ b/tests/components/steam_online/test_config_flow.py @@ -150,11 +150,10 @@ async def test_options_flow(hass: HomeAssistant) -> None: result["flow_id"], user_input={CONF_ACCOUNTS: [ACCOUNT_1, ACCOUNT_2]}, ) - await hass.async_block_till_done() + await hass.async_block_till_done() assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY assert result["data"] == CONF_OPTIONS_2 - assert len(er.async_get(hass).entities) == 2 async def test_options_flow_deselect(hass: HomeAssistant) -> None: @@ -165,6 +164,10 @@ async def test_options_flow_deselect(hass: HomeAssistant) -> None: result = await hass.config_entries.options.async_init(entry.entry_id) await hass.async_block_till_done() + with patch_interface(), patch( + "homeassistant.components.steam_online.async_setup_entry", + return_value=True, + ): assert result["type"] == data_entry_flow.FlowResultType.FORM assert result["step_id"] == "init" @@ -172,6 +175,7 @@ async def test_options_flow_deselect(hass: HomeAssistant) -> None: result["flow_id"], user_input={CONF_ACCOUNTS: []}, ) + await hass.async_block_till_done() assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY assert result["data"] == {CONF_ACCOUNTS: {}}