Fix missing title placeholders during unifiprotect reauth (#70067)

This commit is contained in:
J. Nick Koston 2022-04-15 07:31:50 -10:00 committed by GitHub
parent 1b48d7eda1
commit 03c91dad78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -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(

View file

@ -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",