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:
Manu
2026-09-30 08:06:41 +02:00
committed by GitHub
co-authored by epenet
parent a49e29310d
commit 866dbffb3a
@@ -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"