UniFi - Improve expected SSID filter behavior (#32785)
* Improve expected ssid filter behavior * Fix tests
This commit is contained in:
1 parent
b9ad40ed38
commit
fa63dc1e25
2 files changed
+32
-10
No files matched your search
@@ -124,7 +124,7 @@ async def test_tracked_devices(hass):
|
||||
devices_response=[DEVICE_1, DEVICE_2],
|
||||
known_wireless_clients=(CLIENT_4["mac"],),
|
||||
)
|
||||
assert len(hass.states.async_all()) == 7
|
||||
assert len(hass.states.async_all()) == 6
|
||||
|
||||
client_1 = hass.states.get("device_tracker.client_1")
|
||||
assert client_1 is not None
|
||||
@@ -134,9 +134,9 @@ async def test_tracked_devices(hass):
|
||||
assert client_2 is not None
|
||||
assert client_2.state == "not_home"
|
||||
|
||||
# Client on SSID not in SSID filter
|
||||
client_3 = hass.states.get("device_tracker.client_3")
|
||||
assert client_3 is not None
|
||||
assert client_3.state == "not_home"
|
||||
assert not client_3
|
||||
|
||||
# Wireless client with wired bug, if bug active on restart mark device away
|
||||
client_4 = hass.states.get("device_tracker.client_4")
|
||||
@@ -350,11 +350,11 @@ async def test_option_ssid_filter(hass):
|
||||
controller = await setup_unifi_integration(
|
||||
hass, options={CONF_SSID_FILTER: ["ssid"]}, clients_response=[CLIENT_3],
|
||||
)
|
||||
assert len(hass.states.async_all()) == 2
|
||||
assert len(hass.states.async_all()) == 1
|
||||
|
||||
# SSID filter active
|
||||
client_3 = hass.states.get("device_tracker.client_3")
|
||||
assert client_3.state == "not_home"
|
||||
assert not client_3
|
||||
|
||||
client_3_copy = copy(CLIENT_3)
|
||||
client_3_copy["last_seen"] = dt_util.as_timestamp(dt_util.utcnow())
|
||||
@@ -364,7 +364,7 @@ async def test_option_ssid_filter(hass):
|
||||
|
||||
# SSID filter active even though time stamp should mark as home
|
||||
client_3 = hass.states.get("device_tracker.client_3")
|
||||
assert client_3.state == "not_home"
|
||||
assert not client_3
|
||||
|
||||
# Remove SSID filter
|
||||
hass.config_entries.async_update_entry(
|
||||
|
||||
Reference in new issue
Block a user