mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix reconfigure_confirm logic in madvr config flow (#127216)
This commit is contained in:
parent
a2404e7fb8
commit
8e6b6269a7
@ -1,6 +1,7 @@
|
|||||||
"""Config flow for the integration."""
|
"""Config flow for the integration."""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from collections.abc import Mapping
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -41,17 +42,17 @@ class MadVRConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return await self._handle_config_step(user_input)
|
return await self._handle_config_step(user_input)
|
||||||
|
|
||||||
async def async_step_reconfigure(
|
async def async_step_reconfigure(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, entry_data: Mapping[str, Any]
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle reconfiguration of the device."""
|
"""Handle reconfiguration of the device."""
|
||||||
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"])
|
||||||
return await self.async_step_reconfigure_confirm(user_input)
|
return await self.async_step_reconfigure_confirm()
|
||||||
|
|
||||||
async def async_step_reconfigure_confirm(
|
async def async_step_reconfigure_confirm(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle a reconfiguration flow initialized by the user."""
|
"""Handle a reconfiguration flow initialized by the user."""
|
||||||
return await self._handle_config_step(user_input, step_id="reconfigure")
|
return await self._handle_config_step(user_input, step_id="reconfigure_confirm")
|
||||||
|
|
||||||
async def _handle_config_step(
|
async def _handle_config_step(
|
||||||
self, user_input: dict[str, Any] | None = None, step_id: str = "user"
|
self, user_input: dict[str, Any] | None = None, step_id: str = "user"
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
"port": "The port your madVR Envy is listening on. In 99% of cases, leave this as the default."
|
"port": "The port your madVR Envy is listening on. In 99% of cases, leave this as the default."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"reconfigure": {
|
"reconfigure_confirm": {
|
||||||
"title": "Reconfigure madVR Envy",
|
"title": "Reconfigure madVR Envy",
|
||||||
"description": "Your device needs to be on in order to reconfigure the integation.",
|
"description": "Your device needs to be on in order to reconfigure the integation.",
|
||||||
"data": {
|
"data": {
|
||||||
|
@ -141,7 +141,7 @@ async def test_reconfigure_flow(
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] is FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["step_id"] == "reconfigure"
|
assert result["step_id"] == "reconfigure_confirm"
|
||||||
assert result["errors"] == {}
|
assert result["errors"] == {}
|
||||||
|
|
||||||
# define new host
|
# define new host
|
||||||
@ -213,7 +213,7 @@ async def test_reconfigure_flow_errors(
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] is FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["step_id"] == "reconfigure"
|
assert result["step_id"] == "reconfigure_confirm"
|
||||||
|
|
||||||
# Test CannotConnect error
|
# Test CannotConnect error
|
||||||
mock_madvr_client.open_connection.side_effect = TimeoutError
|
mock_madvr_client.open_connection.side_effect = TimeoutError
|
||||||
|
Loading…
x
Reference in New Issue
Block a user