Extend tests for Stookwijzer init (#131589)

This commit is contained in:
Franck Nijhof 2024-11-26 00:45:47 +01:00 committed by GitHub
parent 5868a4fa21
commit 8e9b5eb4e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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