mirror of
https://github.com/home-assistant/core
synced 2024-08-31 05:57:13 +02:00
Fix cast options flow overwriting data (#49051)
This commit is contained in:
parent
74d7293ab8
commit
1145856c45
@ -133,7 +133,7 @@ class CastOptionsFlowHandler(config_entries.OptionsFlow):
|
||||
)
|
||||
|
||||
if not bad_cec and not bad_hosts and not bad_uuid:
|
||||
updated_config = {}
|
||||
updated_config = dict(current_config)
|
||||
updated_config[CONF_IGNORE_CEC] = ignore_cec
|
||||
updated_config[CONF_KNOWN_HOSTS] = known_hosts
|
||||
updated_config[CONF_UUID] = wanted_uuid
|
||||
|
@ -166,6 +166,7 @@ async def test_option_flow(hass, parameter_data):
|
||||
assert result["step_id"] == "options"
|
||||
data_schema = result["data_schema"].schema
|
||||
assert set(data_schema) == {"known_hosts"}
|
||||
orig_data = dict(config_entry.data)
|
||||
|
||||
# Reconfigure ignore_cec, known_hosts, uuid
|
||||
context = {"source": "user", "show_advanced_options": True}
|
||||
@ -201,7 +202,12 @@ async def test_option_flow(hass, parameter_data):
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result["data"] is None
|
||||
assert config_entry.data == {"ignore_cec": [], "known_hosts": [], "uuid": []}
|
||||
assert config_entry.data == {
|
||||
**orig_data,
|
||||
"ignore_cec": [],
|
||||
"known_hosts": [],
|
||||
"uuid": [],
|
||||
}
|
||||
|
||||
|
||||
async def test_known_hosts(hass, castbrowser_mock, castbrowser_constructor_mock):
|
||||
|
Loading…
Reference in New Issue
Block a user