2020-08-21 07:16:58 +03:00
|
|
|
"""Test the Kodi integration init."""
|
2021-01-01 22:31:56 +01:00
|
|
|
from unittest.mock import patch
|
|
|
|
|
2020-08-21 07:16:58 +03:00
|
|
|
from homeassistant.components.kodi.const import DOMAIN
|
2021-05-20 20:19:20 +03:00
|
|
|
from homeassistant.config_entries import ConfigEntryState
|
2023-02-08 19:06:59 +01:00
|
|
|
from homeassistant.core import HomeAssistant
|
2020-08-21 07:16:58 +03:00
|
|
|
|
|
|
|
from . import init_integration
|
|
|
|
|
|
|
|
|
2023-02-08 19:06:59 +01:00
|
|
|
async def test_unload_entry(hass: HomeAssistant) -> None:
|
2020-08-21 07:16:58 +03: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 20:19:20 +03:00
|
|
|
assert entry.state is ConfigEntryState.LOADED
|
2020-08-21 07:16:58 +03:00
|
|
|
|
|
|
|
assert await hass.config_entries.async_unload(entry.entry_id)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
2021-05-20 20:19:20 +03:00
|
|
|
assert entry.state is ConfigEntryState.NOT_LOADED
|
2020-08-21 07:16:58 +03:00
|
|
|
assert not hass.data.get(DOMAIN)
|