Split the Smarla user flow init from its data (#180665)

This commit is contained in:
Franck Nijhof
2026-08-29 20:52:47 +02:00
committed by GitHub
parent 40b951a2f3
commit 7bb0412239
+27 -9
View File
@@ -52,9 +52,15 @@ async def test_malformed_token(hass: HomeAssistant) -> None:
"homeassistant.components.smarla.config_flow.Connection", side_effect=ValueError
):
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
data=MOCK_USER_INPUT,
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=MOCK_USER_INPUT,
)
assert result["type"] is FlowResultType.FORM
@@ -87,9 +93,15 @@ async def test_validation_exception(
mock_connection.refresh_token.side_effect = exception
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
data=MOCK_USER_INPUT,
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=MOCK_USER_INPUT,
)
mock_connection.refresh_token.side_effect = None
@@ -114,9 +126,15 @@ async def test_device_exists_abort(
mock_config_entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
data=MOCK_USER_INPUT,
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=MOCK_USER_INPUT,
)
assert result["type"] is FlowResultType.ABORT