mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00: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:
|
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_IGNORE_CEC] = ignore_cec
|
||||||
updated_config[CONF_KNOWN_HOSTS] = known_hosts
|
updated_config[CONF_KNOWN_HOSTS] = known_hosts
|
||||||
updated_config[CONF_UUID] = wanted_uuid
|
updated_config[CONF_UUID] = wanted_uuid
|
||||||
|
@ -166,6 +166,7 @@ async def test_option_flow(hass, parameter_data):
|
|||||||
assert result["step_id"] == "options"
|
assert result["step_id"] == "options"
|
||||||
data_schema = result["data_schema"].schema
|
data_schema = result["data_schema"].schema
|
||||||
assert set(data_schema) == {"known_hosts"}
|
assert set(data_schema) == {"known_hosts"}
|
||||||
|
orig_data = dict(config_entry.data)
|
||||||
|
|
||||||
# Reconfigure ignore_cec, known_hosts, uuid
|
# Reconfigure ignore_cec, known_hosts, uuid
|
||||||
context = {"source": "user", "show_advanced_options": True}
|
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["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
assert result["data"] is None
|
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):
|
async def test_known_hosts(hass, castbrowser_mock, castbrowser_constructor_mock):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user