mirror of
https://github.com/home-assistant/core.git
synced 2026-10-06 14:29:21 -04:00
Split user flow init and data submission in energenie_power_sockets config flow tests (#183658)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
This commit is contained in:
@@ -44,15 +44,21 @@ async def test_user_flow_already_exists(
|
||||
mock_search_for_devices: MagicMock,
|
||||
) -> None:
|
||||
"""Test the flow when device has been already configured."""
|
||||
valid_config_entry.add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
data={CONF_DEVICE_API_ID: valid_config_entry.data[CONF_DEVICE_API_ID]},
|
||||
)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert not result["errors"]
|
||||
|
||||
await hass.async_block_till_done()
|
||||
# Adding the entry before init would filter out the device and abort with no_device
|
||||
valid_config_entry.add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{CONF_DEVICE_API_ID: valid_config_entry.data[CONF_DEVICE_API_ID]},
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
Reference in New Issue
Block a user