Use start_reconfigure_flow in config flow tests (#127191)

* Use start_reconfigure_flow in config flow tests

* Adjust fritz
This commit is contained in:
epenet
2024-10-02 10:01:15 +02:00
committed by GitHub
parent 2a2af01d12
commit 9873371413
27 changed files with 77 additions and 464 deletions

View File

@@ -352,14 +352,7 @@ async def test_reconfigure(hass: HomeAssistant) -> None:
)
entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={
"source": config_entries.SOURCE_RECONFIGURE,
"entry_id": entry.entry_id,
},
data=entry.data,
)
result = await entry.start_reconfigure_flow(hass)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "reconfigure"
@@ -406,14 +399,7 @@ async def test_reconfigure_cannot_connect(hass: HomeAssistant) -> None:
)
entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={
"source": config_entries.SOURCE_RECONFIGURE,
"entry_id": entry.entry_id,
},
data=entry.data,
)
result = await entry.start_reconfigure_flow(hass)
with (
patch(
@@ -448,14 +434,7 @@ async def test_reconfigure_unexpected(hass: HomeAssistant) -> None:
)
entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={
"source": config_entries.SOURCE_RECONFIGURE,
"entry_id": entry.entry_id,
},
data=entry.data,
)
result = await entry.start_reconfigure_flow(hass)
with patch(
"pyfronius.Fronius.current_logger_info",
@@ -484,14 +463,7 @@ async def test_reconfigure_already_configured(hass: HomeAssistant) -> None:
)
entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={
"source": config_entries.SOURCE_RECONFIGURE,
"entry_id": entry.entry_id,
},
data=entry.data,
)
result = await entry.start_reconfigure_flow(hass)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "reconfigure"
@@ -545,14 +517,7 @@ async def test_reconfigure_already_existing(hass: HomeAssistant) -> None:
)
entry_2.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={
"source": config_entries.SOURCE_RECONFIGURE,
"entry_id": entry.entry_id,
},
data=entry.data,
)
result = await entry.start_reconfigure_flow(hass)
with patch(
"pyfronius.Fronius.current_logger_info",
return_value={"unique_identifier": {"value": entry_2_uid}},