mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +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(
|
def async_update_reload_and_abort(
|
||||||
self,
|
self,
|
||||||
entry: ConfigEntry,
|
entry: ConfigEntry,
|
||||||
|
*,
|
||||||
|
unique_id: str | None | UndefinedType = UNDEFINED,
|
||||||
title: str | UndefinedType = UNDEFINED,
|
title: str | UndefinedType = UNDEFINED,
|
||||||
data: Mapping[str, Any] | UndefinedType = UNDEFINED,
|
data: Mapping[str, Any] | UndefinedType = UNDEFINED,
|
||||||
options: 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."""
|
"""Update config entry, reload config entry and finish config flow."""
|
||||||
result = self.hass.config_entries.async_update_entry(
|
result = self.hass.config_entries.async_update_entry(
|
||||||
entry=entry,
|
entry=entry,
|
||||||
|
unique_id=unique_id,
|
||||||
title=title,
|
title=title,
|
||||||
data=data,
|
data=data,
|
||||||
options=options,
|
options=options,
|
||||||
|
@ -4152,6 +4152,7 @@ async def test_update_entry_and_reload(
|
|||||||
"""Test updating an entry and reloading."""
|
"""Test updating an entry and reloading."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
domain="comp",
|
domain="comp",
|
||||||
|
unique_id="1234",
|
||||||
title="Test",
|
title="Test",
|
||||||
data={"vendor": "data"},
|
data={"vendor": "data"},
|
||||||
options={"vendor": "options"},
|
options={"vendor": "options"},
|
||||||
@ -4172,6 +4173,7 @@ async def test_update_entry_and_reload(
|
|||||||
"""Mock Reauth."""
|
"""Mock Reauth."""
|
||||||
return self.async_update_reload_and_abort(
|
return self.async_update_reload_and_abort(
|
||||||
entry=entry,
|
entry=entry,
|
||||||
|
unique_id="5678",
|
||||||
title="Updated Title",
|
title="Updated Title",
|
||||||
data={"vendor": "data2"},
|
data={"vendor": "data2"},
|
||||||
options={"vendor": "options2"},
|
options={"vendor": "options2"},
|
||||||
@ -4182,6 +4184,7 @@ async def test_update_entry_and_reload(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert entry.title == "Updated Title"
|
assert entry.title == "Updated Title"
|
||||||
|
assert entry.unique_id == "5678"
|
||||||
assert entry.data == {"vendor": "data2"}
|
assert entry.data == {"vendor": "data2"}
|
||||||
assert entry.options == {"vendor": "options2"}
|
assert entry.options == {"vendor": "options2"}
|
||||||
assert entry.state == config_entries.ConfigEntryState.LOADED
|
assert entry.state == config_entries.ConfigEntryState.LOADED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user