2020-08-21 04:16:58 +00:00
|
|
|
"""Test the Kodi integration init."""
|
2021-01-01 21:31:56 +00:00
|
|
|
from unittest.mock import patch
|
|
|
|
|
2020-08-21 04:16:58 +00:00
|
|
|
from homeassistant.components.kodi.const import DOMAIN
|
2021-05-20 17:19:20 +00:00
|
|
|
from homeassistant.config_entries import ConfigEntryState
|
2023-02-08 18:06:59 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
2020-08-21 04:16:58 +00:00
|
|
|
|
|
|
|
from . import init_integration
|
|
|
|
|
|
|
|
|
2023-02-08 18:06:59 +00:00
|
|
|
async def test_unload_entry(hass: HomeAssistant) -> None:
|
2020-08-21 04:16:58 +00:00
|
|
|
"""Test successful unload of entry."""
|
|
|
|
with patch(
|
|
|
|
"homeassistant.components.kodi.media_player.async_setup_entry",
|
|
|
|
return_value=True,
|
|
|
|
):
|
|
|
|
entry = await init_integration(hass)
|
|
|
|
|
|
|
|
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
|
2021-05-20 17:19:20 +00:00
|
|
|
assert entry.state is ConfigEntryState.LOADED
|
2020-08-21 04:16:58 +00:00
|
|
|
|
|
|
|
assert await hass.config_entries.async_unload(entry.entry_id)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
2021-05-20 17:19:20 +00:00
|
|
|
assert entry.state is ConfigEntryState.NOT_LOADED
|
2020-08-21 04:16:58 +00:00
|
|
|
assert not hass.data.get(DOMAIN)
|