mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 17:31:15 -04:00
Split the Iskra user flow init from its data (#180741)
This commit is contained in:
@@ -171,9 +171,15 @@ async def test_modbus_abort_if_already_setup(
|
||||
|
||||
MockConfigEntry(domain=DOMAIN, unique_id=SERIAL).add_to_hass(hass)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: HOST, CONF_PROTOCOL: "modbus_tcp"},
|
||||
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_HOST: HOST, CONF_PROTOCOL: "modbus_tcp"},
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@@ -197,9 +203,15 @@ async def test_rest_api_abort_if_already_setup(
|
||||
|
||||
MockConfigEntry(domain=DOMAIN, unique_id=SERIAL).add_to_hass(hass)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: HOST, CONF_PROTOCOL: "rest_api"},
|
||||
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_HOST: HOST, CONF_PROTOCOL: "rest_api"},
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
@@ -225,9 +237,15 @@ async def test_modbus_device_error(
|
||||
mock_pyiskra_modbus.side_effect = s_effect
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: HOST, CONF_PROTOCOL: "modbus_tcp"},
|
||||
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_HOST: HOST, CONF_PROTOCOL: "modbus_tcp"},
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@@ -287,9 +305,15 @@ async def test_rest_device_error(
|
||||
mock_pyiskra_rest.side_effect = s_effect
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: HOST, CONF_PROTOCOL: "rest_api"},
|
||||
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_HOST: HOST, CONF_PROTOCOL: "rest_api"},
|
||||
)
|
||||
|
||||
# Test if error returned
|
||||
|
||||
Reference in New Issue
Block a user