1
mirror of https://github.com/home-assistant/core synced 2024-09-15 17:29:45 +02:00

Correct handling if WIFI combine suffix is "None" (#90528)

* Correct handling of "None" WIFI combine suffix

* Update tests/components/unifi/test_config_flow.py

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>

* Update tests/components/unifi/test_config_flow.py

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>

---------

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
This commit is contained in:
Nerdix 2023-04-03 09:47:08 +02:00 committed by GitHub
parent 580b20b0a8
commit d539bddabc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -313,6 +313,7 @@ class UnifiOptionsFlowHandler(config_entries.OptionsFlow):
f"{wlan.name}{wlan.name_combine_suffix}"
for wlan in self.controller.api.wlans.values()
if not wlan.name_combine_enabled
and wlan.name_combine_suffix is not None
}
| {
wlan["name"]

View File

@ -76,6 +76,7 @@ DEVICES = [
WLANS = [
{"name": "SSID 1"},
{"name": "SSID 2", "name_combine_enabled": False, "name_combine_suffix": "_IOT"},
{"name": "SSID 4", "name_combine_enabled": False},
]
DPI_GROUPS = [
@ -459,17 +460,21 @@ async def test_advanced_option_flow(
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "device_tracker"
assert not result["last_step"]
assert set(
result["data_schema"].schema[CONF_SSID_FILTER].options.keys()
).intersection(("SSID 1", "SSID 2", "SSID 2_IOT", "SSID 3"))
assert list(result["data_schema"].schema[CONF_SSID_FILTER].options.keys()) == [
"",
"SSID 1",
"SSID 2",
"SSID 2_IOT",
"SSID 3",
"SSID 4",
]
result = await hass.config_entries.options.async_configure(
result["flow_id"],
user_input={
CONF_TRACK_CLIENTS: False,
CONF_TRACK_WIRED_CLIENTS: False,
CONF_TRACK_DEVICES: False,
CONF_SSID_FILTER: ["SSID 1", "SSID 2_IOT", "SSID 3"],
CONF_SSID_FILTER: ["SSID 1", "SSID 2_IOT", "SSID 3", "SSID 4"],
CONF_DETECTION_TIME: 100,
},
)
@ -503,7 +508,7 @@ async def test_advanced_option_flow(
CONF_TRACK_CLIENTS: False,
CONF_TRACK_WIRED_CLIENTS: False,
CONF_TRACK_DEVICES: False,
CONF_SSID_FILTER: ["SSID 1", "SSID 2_IOT", "SSID 3"],
CONF_SSID_FILTER: ["SSID 1", "SSID 2_IOT", "SSID 3", "SSID 4"],
CONF_DETECTION_TIME: 100,
CONF_IGNORE_WIRED_BUG: False,
CONF_DPI_RESTRICTIONS: False,