mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Split inexogy config flow test submissions (#179265)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user