mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
Extend tests for Stookwijzer init (#131589)
This commit is contained in:
parent
5868a4fa21
commit
8e9b5eb4e1
@ -14,6 +14,41 @@ from homeassistant.helpers import entity_registry as er, issue_registry as ir
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_load_unload_config_entry(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_stookwijzer: MagicMock,
|
||||
) -> None:
|
||||
"""Test the Stookwijzer configuration entry loading and unloading."""
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_config_entry.state is ConfigEntryState.LOADED
|
||||
assert len(mock_stookwijzer.return_value.async_update.mock_calls) == 1
|
||||
|
||||
await hass.config_entries.async_unload(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
|
||||
|
||||
async def test_config_entry_not_ready(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_stookwijzer: MagicMock,
|
||||
) -> None:
|
||||
"""Test the Stookwijzer configuration entry loading and unloading."""
|
||||
mock_stookwijzer.return_value.advice = None
|
||||
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_config_entry.state is ConfigEntryState.SETUP_RETRY
|
||||
assert len(mock_stookwijzer.return_value.async_update.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_migrate_entry(
|
||||
hass: HomeAssistant,
|
||||
mock_v1_config_entry: MockConfigEntry,
|
||||
|
Loading…
x
Reference in New Issue
Block a user