From 3d1e57766a08bb70a667d7d858175bf2c0e34d0d Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 9 Oct 2024 15:34:11 +0200 Subject: [PATCH] Simplify jewish_calendar reconfigure flow (#128008) * Simplify jewish_calendar reconfigure flow * Adjust --- .../components/jewish_calendar/config_flow.py | 17 ++++------------- .../jewish_calendar/test_config_flow.py | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/jewish_calendar/config_flow.py b/homeassistant/components/jewish_calendar/config_flow.py index 67223324ae9..f96699d01bd 100644 --- a/homeassistant/components/jewish_calendar/config_flow.py +++ b/homeassistant/components/jewish_calendar/config_flow.py @@ -87,7 +87,6 @@ class JewishCalendarConfigFlow(ConfigFlow, domain=DOMAIN): """Handle a config flow for Jewish calendar.""" VERSION = 1 - _config_entry: ConfigEntry @staticmethod @callback @@ -133,25 +132,17 @@ class JewishCalendarConfigFlow(ConfigFlow, domain=DOMAIN): self, user_input: dict[str, Any] | None = None ) -> ConfigFlowResult: """Handle a reconfiguration flow initialized by the user.""" - self._config_entry = self._get_reconfigure_entry() - return await self.async_step_reconfigure_confirm() - - async def async_step_reconfigure_confirm( - self, user_input: dict[str, Any] | None = None - ) -> ConfigFlowResult: - """Handle a reconfiguration flow initialized by the user.""" + reconfigure_entry = self._get_reconfigure_entry() if not user_input: return self.async_show_form( data_schema=self.add_suggested_values_to_schema( _get_data_schema(self.hass), - {**self._config_entry.data}, + reconfigure_entry.data, ), - step_id="reconfigure_confirm", + step_id="reconfigure", ) - return self.async_update_reload_and_abort( - self._config_entry, data=user_input, reason="reconfigure_successful" - ) + return self.async_update_reload_and_abort(reconfigure_entry, data=user_input) class JewishCalendarOptionsFlowHandler(OptionsFlowWithConfigEntry): diff --git a/tests/components/jewish_calendar/test_config_flow.py b/tests/components/jewish_calendar/test_config_flow.py index 1468a66efbb..fe31e7b6002 100644 --- a/tests/components/jewish_calendar/test_config_flow.py +++ b/tests/components/jewish_calendar/test_config_flow.py @@ -177,7 +177,7 @@ async def test_reconfigure( # init user flow result = await mock_config_entry.start_reconfigure_flow(hass) assert result["type"] is FlowResultType.FORM - assert result["step_id"] == "reconfigure_confirm" + assert result["step_id"] == "reconfigure" # success result = await hass.config_entries.flow.async_configure( -- GitLab