Correct config entry setup in fritz tests (#110669)

This commit is contained in:
Erik Montnemery 2024-02-15 20:52:40 +01:00 committed by GitHub
parent dbca65dffb
commit ae39945a85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 17 additions and 24 deletions

View file

@ -14,7 +14,6 @@ from homeassistant.components.fritz.const import (
)
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from .const import MOCK_USER_DATA
@ -27,7 +26,7 @@ async def test_setup(hass: HomeAssistant, fc_class_mock, fh_class_mock) -> None:
entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_DATA)
entry.add_to_hass(hass)
assert await async_setup_component(hass, DOMAIN, {})
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert entry.state == ConfigEntryState.LOADED
@ -51,7 +50,7 @@ async def test_options_reload(
"homeassistant.config_entries.ConfigEntries.async_reload",
return_value=None,
) as mock_reload:
assert await async_setup_component(hass, DOMAIN, {})
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert entry.state == ConfigEntryState.LOADED
@ -79,7 +78,7 @@ async def test_setup_auth_fail(hass: HomeAssistant, error) -> None:
"homeassistant.components.fritz.common.FritzConnection",
side_effect=error,
):
assert await async_setup_component(hass, DOMAIN, {})
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert entry.state == ConfigEntryState.SETUP_ERROR
@ -99,7 +98,7 @@ async def test_setup_fail(hass: HomeAssistant, error) -> None:
"homeassistant.components.fritz.common.FritzConnection",
side_effect=error,
):
assert await async_setup_component(hass, DOMAIN, {})
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert entry.state == ConfigEntryState.SETUP_RETRY