2020-08-10 12:19:38 +00:00
|
|
|
"""Test init."""
|
2024-03-08 13:50:04 +00:00
|
|
|
|
2024-06-28 11:34:26 +00:00
|
|
|
import pytest
|
|
|
|
|
2020-08-10 12:19:38 +00:00
|
|
|
from homeassistant.components.flo.const import DOMAIN as FLO_DOMAIN
|
|
|
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
2023-02-13 08:45:11 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
2020-08-10 12:19:38 +00:00
|
|
|
from homeassistant.setup import async_setup_component
|
|
|
|
|
|
|
|
from .common import TEST_PASSWORD, TEST_USER_ID
|
|
|
|
|
2024-06-28 11:34:26 +00:00
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
2020-08-10 12:19:38 +00:00
|
|
|
|
2024-06-28 11:34:26 +00:00
|
|
|
@pytest.mark.usefixtures("aioclient_mock_fixture")
|
|
|
|
async def test_setup_entry(hass: HomeAssistant, config_entry: MockConfigEntry) -> None:
|
2020-08-10 12:19:38 +00:00
|
|
|
"""Test migration of config entry from v1."""
|
|
|
|
config_entry.add_to_hass(hass)
|
|
|
|
assert await async_setup_component(
|
|
|
|
hass, FLO_DOMAIN, {CONF_USERNAME: TEST_USER_ID, CONF_PASSWORD: TEST_PASSWORD}
|
|
|
|
)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-08 12:36:03 +00:00
|
|
|
assert len(hass.data[FLO_DOMAIN][config_entry.entry_id]["devices"]) == 2
|
2020-08-31 13:37:45 +00:00
|
|
|
|
|
|
|
assert await hass.config_entries.async_unload(config_entry.entry_id)
|