Split the LiteJet user flow init from its data (#180738)

This commit is contained in:
Franck Nijhof
2026-08-30 12:16:41 +02:00
committed by GitHub
parent 21f7d4dcb7
commit e5e8a48b9c
+19 -5
View File
@@ -28,7 +28,15 @@ async def test_create_entry(hass: HomeAssistant, mock_litejet) -> None:
test_data = {CONF_PORT: "/dev/test"}
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=test_data
DOMAIN, context={"source": config_entries.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=test_data,
)
assert result["type"] is FlowResultType.CREATE_ENTRY
@@ -44,10 +52,8 @@ async def test_flow_entry_already_exists(hass: HomeAssistant) -> None:
)
first_entry.add_to_hass(hass)
test_data = {CONF_PORT: "/dev/test"}
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=test_data
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] is FlowResultType.ABORT
@@ -62,7 +68,15 @@ async def test_flow_open_failed(hass: HomeAssistant) -> None:
mock_pylitejet.side_effect = SerialException
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=test_data
DOMAIN, context={"source": config_entries.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=test_data,
)
assert result["type"] is FlowResultType.FORM