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
This commit is contained in:
J. Nick Koston 2023-01-24 11:30:28 -10:00 committed by GitHub
parent a4c52567a7
commit b507fb1e06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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: {}}