Fix zone config (#32963)
* Fix zone config * Add zone as dependency again to device tracker * Fix tests
This commit is contained in:
parent
ede0cfaeb8
commit
5123baba3f
6 changed files with 66 additions and 35 deletions
|
@ -109,7 +109,7 @@ async def test_no_clients(hass):
|
|||
"""Test the update_clients function when no clients are found."""
|
||||
await setup_unifi_integration(hass)
|
||||
|
||||
assert len(hass.states.async_all()) == 0
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 0
|
||||
|
||||
|
||||
async def test_tracked_devices(hass):
|
||||
|
@ -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()) == 5
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 5
|
||||
|
||||
client_1 = hass.states.get("device_tracker.client_1")
|
||||
assert client_1 is not None
|
||||
|
@ -185,7 +185,7 @@ async def test_controller_state_change(hass):
|
|||
controller = await setup_unifi_integration(
|
||||
hass, clients_response=[CLIENT_1], devices_response=[DEVICE_1],
|
||||
)
|
||||
assert len(hass.states.async_all()) == 2
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 2
|
||||
|
||||
# Controller unavailable
|
||||
controller.async_unifi_signalling_callback(
|
||||
|
@ -215,7 +215,7 @@ async def test_option_track_clients(hass):
|
|||
controller = await setup_unifi_integration(
|
||||
hass, clients_response=[CLIENT_1, CLIENT_2], devices_response=[DEVICE_1],
|
||||
)
|
||||
assert len(hass.states.async_all()) == 3
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 3
|
||||
|
||||
client_1 = hass.states.get("device_tracker.client_1")
|
||||
assert client_1 is not None
|
||||
|
@ -260,7 +260,7 @@ async def test_option_track_wired_clients(hass):
|
|||
controller = await setup_unifi_integration(
|
||||
hass, clients_response=[CLIENT_1, CLIENT_2], devices_response=[DEVICE_1],
|
||||
)
|
||||
assert len(hass.states.async_all()) == 3
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 3
|
||||
|
||||
client_1 = hass.states.get("device_tracker.client_1")
|
||||
assert client_1 is not None
|
||||
|
@ -305,7 +305,7 @@ async def test_option_track_devices(hass):
|
|||
controller = await setup_unifi_integration(
|
||||
hass, clients_response=[CLIENT_1, CLIENT_2], devices_response=[DEVICE_1],
|
||||
)
|
||||
assert len(hass.states.async_all()) == 3
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 3
|
||||
|
||||
client_1 = hass.states.get("device_tracker.client_1")
|
||||
assert client_1 is not None
|
||||
|
@ -350,7 +350,7 @@ 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()) == 0
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 0
|
||||
|
||||
# SSID filter active
|
||||
client_3 = hass.states.get("device_tracker.client_3")
|
||||
|
@ -388,7 +388,7 @@ async def test_wireless_client_go_wired_issue(hass):
|
|||
client_1_client["last_seen"] = dt_util.as_timestamp(dt_util.utcnow())
|
||||
|
||||
controller = await setup_unifi_integration(hass, clients_response=[client_1_client])
|
||||
assert len(hass.states.async_all()) == 1
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 1
|
||||
|
||||
client_1 = hass.states.get("device_tracker.client_1")
|
||||
assert client_1 is not None
|
||||
|
@ -461,7 +461,7 @@ async def test_restoring_client(hass):
|
|||
clients_response=[CLIENT_2],
|
||||
clients_all_response=[CLIENT_1],
|
||||
)
|
||||
assert len(hass.states.async_all()) == 2
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 2
|
||||
|
||||
device_1 = hass.states.get("device_tracker.client_1")
|
||||
assert device_1 is not None
|
||||
|
@ -475,7 +475,7 @@ async def test_dont_track_clients(hass):
|
|||
clients_response=[CLIENT_1],
|
||||
devices_response=[DEVICE_1],
|
||||
)
|
||||
assert len(hass.states.async_all()) == 1
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 1
|
||||
|
||||
client_1 = hass.states.get("device_tracker.client_1")
|
||||
assert client_1 is None
|
||||
|
@ -493,7 +493,7 @@ async def test_dont_track_devices(hass):
|
|||
clients_response=[CLIENT_1],
|
||||
devices_response=[DEVICE_1],
|
||||
)
|
||||
assert len(hass.states.async_all()) == 1
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 1
|
||||
|
||||
client_1 = hass.states.get("device_tracker.client_1")
|
||||
assert client_1 is not None
|
||||
|
@ -510,7 +510,7 @@ async def test_dont_track_wired_clients(hass):
|
|||
options={unifi.controller.CONF_TRACK_WIRED_CLIENTS: False},
|
||||
clients_response=[CLIENT_1, CLIENT_2],
|
||||
)
|
||||
assert len(hass.states.async_all()) == 1
|
||||
assert len(hass.states.async_entity_ids("device_tracker")) == 1
|
||||
|
||||
client_1 = hass.states.get("device_tracker.client_1")
|
||||
assert client_1 is not None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue