From 03c91dad78d6a622502100dff64808a30f01f770 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 15 Apr 2022 07:31:50 -1000 Subject: [PATCH] Fix missing title placeholders during unifiprotect reauth (#70067) --- homeassistant/components/unifiprotect/config_flow.py | 4 ++++ tests/components/unifiprotect/test_config_flow.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/homeassistant/components/unifiprotect/config_flow.py b/homeassistant/components/unifiprotect/config_flow.py index bd66b5f086a..0cfce44a6ca 100644 --- a/homeassistant/components/unifiprotect/config_flow.py +++ b/homeassistant/components/unifiprotect/config_flow.py @@ -259,6 +259,10 @@ class ProtectFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): await self.hass.config_entries.async_reload(self.entry.entry_id) return self.async_abort(reason="reauth_successful") + self.context["title_placeholders"] = { + "name": self.entry.title, + "ip_address": self.entry.data[CONF_HOST], + } return self.async_show_form( step_id="reauth_confirm", data_schema=vol.Schema( diff --git a/tests/components/unifiprotect/test_config_flow.py b/tests/components/unifiprotect/test_config_flow.py index 78931aa460a..59304ce915f 100644 --- a/tests/components/unifiprotect/test_config_flow.py +++ b/tests/components/unifiprotect/test_config_flow.py @@ -193,6 +193,11 @@ async def test_form_reauth_auth(hass: HomeAssistant, mock_nvr: NVR) -> None: ) assert result["type"] == RESULT_TYPE_FORM assert not result["errors"] + flows = hass.config_entries.flow.async_progress_by_handler(DOMAIN) + assert flows[0]["context"]["title_placeholders"] == { + "ip_address": "1.1.1.1", + "name": "Mock Title", + } with patch( "homeassistant.components.unifiprotect.config_flow.ProtectApiClient.get_nvr",