Split inexogy config flow test submissions (#179265)

This commit is contained in:
Jan-Philipp Benecke
2026-08-16 14:44:31 +02:00
committed by GitHub
parent 4cb0c12e8e
commit ce1c96bcd5
@@ -84,14 +84,22 @@ async def test_form_fail(
hass: HomeAssistant, discovergy: AsyncMock, error: Exception, message: str
) -> None:
"""Test to handle exceptions."""
user_input = {
CONF_EMAIL: "test@example.com",
CONF_PASSWORD: "test-password",
}
discovergy.meters.side_effect = error
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
data={
CONF_EMAIL: "test@example.com",
CONF_PASSWORD: "test-password",
},
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
assert result["errors"] == {}
result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input=user_input
)
assert result["type"] is FlowResultType.FORM
@@ -101,11 +109,7 @@ async def test_form_fail(
# reset and test for success
discovergy.meters.side_effect = None
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
{
CONF_EMAIL: "test@example.com",
CONF_PASSWORD: "test-password",
},
result["flow_id"], user_input=user_input
)
assert result["type"] is FlowResultType.CREATE_ENTRY