* 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>
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""Tests for the Kodi integration."""
|
|
from homeassistant.components.kodi.const import CONF_WS_PORT, DOMAIN
|
|
from homeassistant.const import (
|
|
CONF_HOST,
|
|
CONF_NAME,
|
|
CONF_PASSWORD,
|
|
CONF_PORT,
|
|
CONF_SSL,
|
|
CONF_USERNAME,
|
|
)
|
|
|
|
from .util import MockConnection
|
|
|
|
from tests.async_mock import patch
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
async def init_integration(hass) -> MockConfigEntry:
|
|
"""Set up the Kodi integration in Home Assistant."""
|
|
entry_data = {
|
|
CONF_NAME: "name",
|
|
CONF_HOST: "1.1.1.1",
|
|
CONF_PORT: 8080,
|
|
CONF_WS_PORT: 9090,
|
|
CONF_USERNAME: "user",
|
|
CONF_PASSWORD: "pass",
|
|
CONF_SSL: False,
|
|
}
|
|
entry = MockConfigEntry(domain=DOMAIN, data=entry_data, title="name")
|
|
with patch("homeassistant.components.kodi.Kodi.ping", return_value=True), patch(
|
|
"homeassistant.components.kodi.Kodi.get_application_properties",
|
|
return_value={"version": {"major": 1, "minor": 1}},
|
|
), patch(
|
|
"homeassistant.components.kodi.get_kodi_connection",
|
|
return_value=MockConnection(),
|
|
):
|
|
entry.add_to_hass(hass)
|
|
await hass.config_entries.async_setup(entry.entry_id)
|
|
await hass.async_block_till_done()
|
|
|
|
return entry
|