mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Extend config entry update/abort helper to also update unique id (#108681)
* Extend config entry update/abort helper to also update unique id * Move kwarg to end * Make additionals kwargs only
This commit is contained in:
parent
9ee8832367
commit
0b79504cf0
@ -1941,6 +1941,8 @@ class ConfigFlow(data_entry_flow.FlowHandler):
|
||||
def async_update_reload_and_abort(
|
||||
self,
|
||||
entry: ConfigEntry,
|
||||
*,
|
||||
unique_id: str | None | UndefinedType = UNDEFINED,
|
||||
title: str | UndefinedType = UNDEFINED,
|
||||
data: Mapping[str, Any] | UndefinedType = UNDEFINED,
|
||||
options: Mapping[str, Any] | UndefinedType = UNDEFINED,
|
||||
@ -1949,6 +1951,7 @@ class ConfigFlow(data_entry_flow.FlowHandler):
|
||||
"""Update config entry, reload config entry and finish config flow."""
|
||||
result = self.hass.config_entries.async_update_entry(
|
||||
entry=entry,
|
||||
unique_id=unique_id,
|
||||
title=title,
|
||||
data=data,
|
||||
options=options,
|
||||
|
@ -4152,6 +4152,7 @@ async def test_update_entry_and_reload(
|
||||
"""Test updating an entry and reloading."""
|
||||
entry = MockConfigEntry(
|
||||
domain="comp",
|
||||
unique_id="1234",
|
||||
title="Test",
|
||||
data={"vendor": "data"},
|
||||
options={"vendor": "options"},
|
||||
@ -4172,6 +4173,7 @@ async def test_update_entry_and_reload(
|
||||
"""Mock Reauth."""
|
||||
return self.async_update_reload_and_abort(
|
||||
entry=entry,
|
||||
unique_id="5678",
|
||||
title="Updated Title",
|
||||
data={"vendor": "data2"},
|
||||
options={"vendor": "options2"},
|
||||
@ -4182,6 +4184,7 @@ async def test_update_entry_and_reload(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert entry.title == "Updated Title"
|
||||
assert entry.unique_id == "5678"
|
||||
assert entry.data == {"vendor": "data2"}
|
||||
assert entry.options == {"vendor": "options2"}
|
||||
assert entry.state == config_entries.ConfigEntryState.LOADED
|
||||
|
Loading…
x
Reference in New Issue
Block a user