Move Insteon configuration panel to config entry (#105581)
* Move Insteon panel to the config menu * Bump pyinsteon to 1.5.3 * Undo devcontainer.json changes * Bump Insteon frontend * Update config_flow.py * Code cleanup * Code review changes * Fix failing tests * Fix format * Remove unnecessary exception * codecov * Remove return from try * Fix merge mistake --------- Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
parent
1dfabf34c4
commit
c5c407b3bb
17 changed files with 988 additions and 766 deletions
|
@ -1,6 +1,5 @@
|
|||
"""Test the init file for the Insteon component."""
|
||||
|
||||
import asyncio
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
@ -11,7 +10,7 @@ from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .const import MOCK_USER_INPUT_PLM, PATCH_CONNECTION
|
||||
from .const import MOCK_USER_INPUT_PLM
|
||||
from .mock_devices import MockDevices
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
@ -70,22 +69,24 @@ async def test_setup_entry_failed_connection(
|
|||
|
||||
async def test_import_frontend_dev_url(hass: HomeAssistant) -> None:
|
||||
"""Test importing a dev_url config entry."""
|
||||
config = {}
|
||||
config[DOMAIN] = {CONF_DEV_PATH: "/some/path"}
|
||||
config_entry = MockConfigEntry(
|
||||
domain=DOMAIN, data=MOCK_USER_INPUT_PLM, options={CONF_DEV_PATH: "/some/path"}
|
||||
)
|
||||
config_entry.add_to_hass(hass)
|
||||
|
||||
with (
|
||||
patch.object(insteon, "async_connect", new=mock_successful_connection),
|
||||
patch.object(insteon, "close_insteon_connection"),
|
||||
patch.object(insteon, "async_close") as mock_close,
|
||||
patch.object(insteon, "devices", new=MockDevices()),
|
||||
patch(
|
||||
PATCH_CONNECTION,
|
||||
new=mock_successful_connection,
|
||||
),
|
||||
):
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
insteon.DOMAIN,
|
||||
config,
|
||||
{},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
await asyncio.sleep(0.01)
|
||||
assert hass.data[DOMAIN][CONF_DEV_PATH] == "/some/path"
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_STOP)
|
||||
await hass.async_block_till_done()
|
||||
assert insteon.devices.async_save.call_count == 1
|
||||
assert mock_close.called
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue