mirror of
https://github.com/jdejaegh/irm-kmi-ha.git
synced 2025-06-27 19:49:26 +02:00
33 lines
1 KiB
Python
33 lines
1 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 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},
|
|
)
|
|
|
|
assert result2.get("type") == FlowResultType.CREATE_ENTRY
|
|
assert result2.get("title") == "IRM KMI"
|
|
assert result2.get("data") == {CONF_ZONE: ENTITY_ID_HOME}
|