mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Automatically add entry title as name placeholder in reauth (#64078)
This commit is contained in:
parent
7943b0ff5e
commit
9e33a3014c
@ -608,6 +608,7 @@ class ConfigEntry:
|
|||||||
flow_context = {
|
flow_context = {
|
||||||
"source": SOURCE_REAUTH,
|
"source": SOURCE_REAUTH,
|
||||||
"entry_id": self.entry_id,
|
"entry_id": self.entry_id,
|
||||||
|
"title_placeholders": {"name": self.title},
|
||||||
"unique_id": self.unique_id,
|
"unique_id": self.unique_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -897,6 +897,7 @@ async def test_setup_entry_no_token_reauth(hass: HomeAssistant) -> None:
|
|||||||
CONF_SOURCE: SOURCE_REAUTH,
|
CONF_SOURCE: SOURCE_REAUTH,
|
||||||
"entry_id": config_entry.entry_id,
|
"entry_id": config_entry.entry_id,
|
||||||
"unique_id": config_entry.unique_id,
|
"unique_id": config_entry.unique_id,
|
||||||
|
"title_placeholders": {"name": config_entry.title},
|
||||||
},
|
},
|
||||||
data=config_entry.data,
|
data=config_entry.data,
|
||||||
)
|
)
|
||||||
@ -925,6 +926,7 @@ async def test_setup_entry_bad_token_reauth(hass: HomeAssistant) -> None:
|
|||||||
CONF_SOURCE: SOURCE_REAUTH,
|
CONF_SOURCE: SOURCE_REAUTH,
|
||||||
"entry_id": config_entry.entry_id,
|
"entry_id": config_entry.entry_id,
|
||||||
"unique_id": config_entry.unique_id,
|
"unique_id": config_entry.unique_id,
|
||||||
|
"title_placeholders": {"name": config_entry.title},
|
||||||
},
|
},
|
||||||
data=config_entry.data,
|
data=config_entry.data,
|
||||||
)
|
)
|
||||||
|
@ -43,6 +43,7 @@ async def test_setup_auth_failed(setup_component, hass, config_entry, smarttub_a
|
|||||||
"source": SOURCE_REAUTH,
|
"source": SOURCE_REAUTH,
|
||||||
"entry_id": config_entry.entry_id,
|
"entry_id": config_entry.entry_id,
|
||||||
"unique_id": config_entry.unique_id,
|
"unique_id": config_entry.unique_id,
|
||||||
|
"title_placeholders": {"name": config_entry.title},
|
||||||
},
|
},
|
||||||
data=config_entry.data,
|
data=config_entry.data,
|
||||||
)
|
)
|
||||||
|
@ -33,6 +33,7 @@ async def test_config_entry_reauth(
|
|||||||
CONF_SOURCE: SOURCE_REAUTH,
|
CONF_SOURCE: SOURCE_REAUTH,
|
||||||
"entry_id": entry.entry_id,
|
"entry_id": entry.entry_id,
|
||||||
"unique_id": entry.unique_id,
|
"unique_id": entry.unique_id,
|
||||||
|
"title_placeholders": {"name": entry.title},
|
||||||
},
|
},
|
||||||
data=entry.data,
|
data=entry.data,
|
||||||
)
|
)
|
||||||
|
@ -2739,6 +2739,7 @@ async def test_setup_raise_auth_failed(hass, caplog):
|
|||||||
assert len(flows) == 1
|
assert len(flows) == 1
|
||||||
assert flows[0]["context"]["entry_id"] == entry.entry_id
|
assert flows[0]["context"]["entry_id"] == entry.entry_id
|
||||||
assert flows[0]["context"]["source"] == config_entries.SOURCE_REAUTH
|
assert flows[0]["context"]["source"] == config_entries.SOURCE_REAUTH
|
||||||
|
assert flows[0]["context"]["title_placeholders"] == {"name": "test_title"}
|
||||||
|
|
||||||
caplog.clear()
|
caplog.clear()
|
||||||
entry.state = config_entries.ConfigEntryState.NOT_LOADED
|
entry.state = config_entries.ConfigEntryState.NOT_LOADED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user