mirror of
https://github.com/jdejaegh/irm-kmi-ha.git
synced 2025-06-27 03:35:56 +02:00
38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
"""Tests for the IRM KMI config flow."""
|
|
|
|
from unittest.mock import MagicMock
|
|
|
|
from homeassistant.components.zone import ENTITY_ID_HOME
|
|
from homeassistant.config_entries import SOURCE_USER
|
|
from homeassistant.const import CONF_ZONE
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.data_entry_flow import FlowResultType
|
|
|
|
from custom_components.irm_kmi.const import (CONF_DARK_MODE, CONF_STYLE,
|
|
CONF_STYLE_STD, DOMAIN)
|
|
|
|
|
|
async def test_full_user_flow(
|
|
hass: HomeAssistant,
|
|
mock_setup_entry: MagicMock,
|
|
) -> None:
|
|
"""Test the full user configuration flow."""
|
|
result = await hass.config_entries.flow.async_init(
|
|
DOMAIN, context={"source": SOURCE_USER}
|
|
)
|
|
|
|
assert result.get("type") == FlowResultType.FORM
|
|
assert result.get("step_id") == "user"
|
|
|
|
result2 = await hass.config_entries.flow.async_configure(
|
|
result["flow_id"],
|
|
user_input={CONF_ZONE: ENTITY_ID_HOME,
|
|
CONF_STYLE: CONF_STYLE_STD,
|
|
CONF_DARK_MODE: False},
|
|
)
|
|
print(result2)
|
|
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
|
assert result2.get("title") == "test home"
|
|
assert result2.get("data") == {CONF_ZONE: ENTITY_ID_HOME,
|
|
CONF_STYLE: CONF_STYLE_STD,
|
|
CONF_DARK_MODE: False}
|