1
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:
Erik Montnemery 2021-04-12 01:53:44 +02:00 committed by GitHub
parent 74d7293ab8
commit 1145856c45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

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

View File

@ -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):