hass-core/tests/components/kodi/test_init.py
On Freund c1ed584f2d
Add config flow to kodi (#38551)
* Add config flow to kodi

* Fix lint errors

* Remove entry update listener

* Create test_init.py

* Apply suggestions from code review

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

* Update __init__.py

* fix indentation

* Apply suggestions from code review

* Apply suggestions from code review

* Update tests/components/kodi/__init__.py

* Fix init test

* Fix merge

* More review changes

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

* Fix black formatting

* Fix Flake8

* Don't store CONF_ID

* Fall back to entry id

* Apply suggestions from code review

Co-authored-by: J. Nick Koston <nick@koston.org>

* Update __init__.py

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Chris Talkington <chris@talkingtontech.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-08-20 23:16:58 -05:00

25 lines
794 B
Python

"""Test the Kodi integration init."""
from homeassistant.components.kodi.const import DOMAIN
from homeassistant.config_entries import ENTRY_STATE_LOADED, ENTRY_STATE_NOT_LOADED
from . import init_integration
from tests.async_mock import patch
async def test_unload_entry(hass):
"""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
assert entry.state == ENTRY_STATE_LOADED
assert await hass.config_entries.async_unload(entry.entry_id)
await hass.async_block_till_done()
assert entry.state == ENTRY_STATE_NOT_LOADED
assert not hass.data.get(DOMAIN)