mirror of
https://github.com/home-assistant/core.git
synced 2026-09-27 09:58:07 -04:00
Split the Twente Milieu user flow init from its data (#180645)
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user