Split the Twente Milieu user flow init from its data (#180645)

This commit is contained in:
Franck Nijhof
2026-08-29 18:41:42 +02:00
committed by GitHub
parent a1f7924904
commit 6a1fe7c7f8
@@ -5,7 +5,6 @@ from unittest.mock import MagicMock
import pytest
from twentemilieu import TwenteMilieuAddressError, TwenteMilieuConnectionError
from homeassistant import config_entries
from homeassistant.components.twentemilieu.const import (
CONF_HOUSE_LETTER,
CONF_HOUSE_NUMBER,
@@ -113,9 +112,15 @@ async def test_connection_error(
mock_twentemilieu.unique_id.side_effect = TwenteMilieuConnectionError
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
data={
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input={
CONF_POST_CODE: "1234AB",
CONF_HOUSE_NUMBER: "1",
CONF_HOUSE_LETTER: "A",
@@ -159,9 +164,15 @@ async def test_address_already_set_up(
"""Test we abort if address has already been set up."""
mock_config_entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
data={
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
user_input={
CONF_POST_CODE: "1234AB",
CONF_HOUSE_NUMBER: "1",
CONF_HOUSE_LETTER: "A",