Allow hidden entities to be selected in homekit include mode (#71250)
This commit is contained in:
parent
eba125b093
commit
60bfcc6be4
2 changed files with 22 additions and 16 deletions
|
@ -1504,7 +1504,7 @@ async def test_options_flow_exclude_mode_skips_hidden_entities(
|
|||
|
||||
|
||||
@patch(f"{PATH_HOMEKIT}.async_port_is_available", return_value=True)
|
||||
async def test_options_flow_include_mode_skips_hidden_entities(
|
||||
async def test_options_flow_include_mode_allows_hidden_entities(
|
||||
port_mock, hass, mock_get_source_ip, hk_driver, mock_async_zeroconf, entity_reg
|
||||
):
|
||||
"""Ensure include mode does not offer hidden entities."""
|
||||
|
@ -1558,24 +1558,28 @@ async def test_options_flow_include_mode_skips_hidden_entities(
|
|||
assert _get_schema_default(result2["data_schema"].schema, "entities") == []
|
||||
|
||||
# sonos_hidden_switch.entity_id is a hidden entity
|
||||
# so it should not be selectable since it will always be excluded
|
||||
with pytest.raises(voluptuous.error.MultipleInvalid):
|
||||
await hass.config_entries.options.async_configure(
|
||||
result2["flow_id"],
|
||||
user_input={"entities": [sonos_hidden_switch.entity_id]},
|
||||
)
|
||||
|
||||
result4 = await hass.config_entries.options.async_configure(
|
||||
# we allow it to be selected in include mode only
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
result2["flow_id"],
|
||||
user_input={"entities": ["media_player.tv", "switch.other"]},
|
||||
user_input={
|
||||
"entities": [
|
||||
sonos_hidden_switch.entity_id,
|
||||
"media_player.tv",
|
||||
"switch.other",
|
||||
]
|
||||
},
|
||||
)
|
||||
assert result4["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
"mode": "bridge",
|
||||
"filter": {
|
||||
"exclude_domains": [],
|
||||
"exclude_entities": [],
|
||||
"include_domains": [],
|
||||
"include_entities": ["media_player.tv", "switch.other"],
|
||||
"include_entities": [
|
||||
sonos_hidden_switch.entity_id,
|
||||
"media_player.tv",
|
||||
"switch.other",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue