Upgrade black to 20.8b1 (#39287)
This commit is contained in:
1 parent
0d7eec710c
commit
1c2ebdf307
574 files changed
+4389
-1725
No files matched your search
@@ -130,7 +130,8 @@ async def setup_unifi_integration(
|
||||
return {}
|
||||
|
||||
with patch("aiounifi.Controller.check_unifi_os", return_value=True), patch(
|
||||
"aiounifi.Controller.login", return_value=True,
|
||||
"aiounifi.Controller.login",
|
||||
return_value=True,
|
||||
), patch("aiounifi.Controller.sites", return_value=sites), patch(
|
||||
"aiounifi.Controller.site_description", return_value=site_description
|
||||
), patch(
|
||||
|
||||
@@ -265,7 +265,8 @@ async def test_tracked_clients(hass):
|
||||
async def test_tracked_devices(hass):
|
||||
"""Test the update_items function with some devices."""
|
||||
controller = await setup_unifi_integration(
|
||||
hass, devices_response=[DEVICE_1, DEVICE_2],
|
||||
hass,
|
||||
devices_response=[DEVICE_1, DEVICE_2],
|
||||
)
|
||||
assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 2
|
||||
|
||||
@@ -360,7 +361,9 @@ async def test_remove_clients(hass):
|
||||
async def test_controller_state_change(hass):
|
||||
"""Verify entities state reflect on controller becoming unavailable."""
|
||||
controller = await setup_unifi_integration(
|
||||
hass, clients_response=[CLIENT_1], devices_response=[DEVICE_1],
|
||||
hass,
|
||||
clients_response=[CLIENT_1],
|
||||
devices_response=[DEVICE_1],
|
||||
)
|
||||
assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 2
|
||||
|
||||
@@ -390,7 +393,9 @@ async def test_controller_state_change(hass):
|
||||
async def test_option_track_clients(hass):
|
||||
"""Test the tracking of clients can be turned off."""
|
||||
controller = await setup_unifi_integration(
|
||||
hass, clients_response=[CLIENT_1, CLIENT_2], devices_response=[DEVICE_1],
|
||||
hass,
|
||||
clients_response=[CLIENT_1, CLIENT_2],
|
||||
devices_response=[DEVICE_1],
|
||||
)
|
||||
assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 3
|
||||
|
||||
@@ -404,7 +409,8 @@ async def test_option_track_clients(hass):
|
||||
assert device_1 is not None
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_TRACK_CLIENTS: False},
|
||||
controller.config_entry,
|
||||
options={CONF_TRACK_CLIENTS: False},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -418,7 +424,8 @@ async def test_option_track_clients(hass):
|
||||
assert device_1 is not None
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_TRACK_CLIENTS: True},
|
||||
controller.config_entry,
|
||||
options={CONF_TRACK_CLIENTS: True},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -435,7 +442,9 @@ async def test_option_track_clients(hass):
|
||||
async def test_option_track_wired_clients(hass):
|
||||
"""Test the tracking of wired clients can be turned off."""
|
||||
controller = await setup_unifi_integration(
|
||||
hass, clients_response=[CLIENT_1, CLIENT_2], devices_response=[DEVICE_1],
|
||||
hass,
|
||||
clients_response=[CLIENT_1, CLIENT_2],
|
||||
devices_response=[DEVICE_1],
|
||||
)
|
||||
assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 3
|
||||
|
||||
@@ -449,7 +458,8 @@ async def test_option_track_wired_clients(hass):
|
||||
assert device_1 is not None
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_TRACK_WIRED_CLIENTS: False},
|
||||
controller.config_entry,
|
||||
options={CONF_TRACK_WIRED_CLIENTS: False},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -463,7 +473,8 @@ async def test_option_track_wired_clients(hass):
|
||||
assert device_1 is not None
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_TRACK_WIRED_CLIENTS: True},
|
||||
controller.config_entry,
|
||||
options={CONF_TRACK_WIRED_CLIENTS: True},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -480,7 +491,9 @@ async def test_option_track_wired_clients(hass):
|
||||
async def test_option_track_devices(hass):
|
||||
"""Test the tracking of devices can be turned off."""
|
||||
controller = await setup_unifi_integration(
|
||||
hass, clients_response=[CLIENT_1, CLIENT_2], devices_response=[DEVICE_1],
|
||||
hass,
|
||||
clients_response=[CLIENT_1, CLIENT_2],
|
||||
devices_response=[DEVICE_1],
|
||||
)
|
||||
assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 3
|
||||
|
||||
@@ -494,7 +507,8 @@ async def test_option_track_devices(hass):
|
||||
assert device_1 is not None
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_TRACK_DEVICES: False},
|
||||
controller.config_entry,
|
||||
options={CONF_TRACK_DEVICES: False},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -508,7 +522,8 @@ async def test_option_track_devices(hass):
|
||||
assert device_1 is None
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_TRACK_DEVICES: True},
|
||||
controller.config_entry,
|
||||
options={CONF_TRACK_DEVICES: True},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -544,7 +559,8 @@ async def test_option_ssid_filter(hass):
|
||||
|
||||
# Setting SSID filter will remove clients outside of filter
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_SSID_FILTER: ["ssid"]},
|
||||
controller.config_entry,
|
||||
options={CONF_SSID_FILTER: ["ssid"]},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -578,7 +594,8 @@ async def test_option_ssid_filter(hass):
|
||||
|
||||
# Remove SSID filter
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_SSID_FILTER: []},
|
||||
controller.config_entry,
|
||||
options={CONF_SSID_FILTER: []},
|
||||
)
|
||||
event = {"meta": {"message": MESSAGE_CLIENT}, "data": [client_1_copy]}
|
||||
controller.api.message_handler(event)
|
||||
@@ -788,7 +805,8 @@ async def test_dont_track_clients(hass):
|
||||
assert device_1 is not None
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_TRACK_CLIENTS: True},
|
||||
controller.config_entry,
|
||||
options={CONF_TRACK_CLIENTS: True},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -818,7 +836,8 @@ async def test_dont_track_devices(hass):
|
||||
assert device_1 is None
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_TRACK_DEVICES: True},
|
||||
controller.config_entry,
|
||||
options={CONF_TRACK_DEVICES: True},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -847,7 +866,8 @@ async def test_dont_track_wired_clients(hass):
|
||||
assert client_2 is None
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_TRACK_WIRED_CLIENTS: True},
|
||||
controller.config_entry,
|
||||
options={CONF_TRACK_WIRED_CLIENTS: True},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
@@ -60,7 +60,8 @@ async def test_platform_manually_configured(hass):
|
||||
async def test_no_clients(hass):
|
||||
"""Test the update_clients function when no clients are found."""
|
||||
controller = await setup_unifi_integration(
|
||||
hass, options={CONF_ALLOW_BANDWIDTH_SENSORS: True},
|
||||
hass,
|
||||
options={CONF_ALLOW_BANDWIDTH_SENSORS: True},
|
||||
)
|
||||
|
||||
assert len(controller.mock_requests) == 4
|
||||
@@ -110,7 +111,8 @@ async def test_sensors(hass):
|
||||
assert wireless_client_tx.state == "6789.0"
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_ALLOW_BANDWIDTH_SENSORS: False},
|
||||
controller.config_entry,
|
||||
options={CONF_ALLOW_BANDWIDTH_SENSORS: False},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -121,7 +123,8 @@ async def test_sensors(hass):
|
||||
assert wireless_client_tx is None
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_ALLOW_BANDWIDTH_SENSORS: True},
|
||||
controller.config_entry,
|
||||
options={CONF_ALLOW_BANDWIDTH_SENSORS: True},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -135,7 +138,9 @@ async def test_sensors(hass):
|
||||
async def test_remove_sensors(hass):
|
||||
"""Test the remove_items function with some clients."""
|
||||
controller = await setup_unifi_integration(
|
||||
hass, options={CONF_ALLOW_BANDWIDTH_SENSORS: True}, clients_response=CLIENTS,
|
||||
hass,
|
||||
options={CONF_ALLOW_BANDWIDTH_SENSORS: True},
|
||||
clients_response=CLIENTS,
|
||||
)
|
||||
assert len(hass.states.async_entity_ids(SENSOR_DOMAIN)) == 4
|
||||
assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 2
|
||||
|
||||
@@ -265,7 +265,8 @@ async def test_platform_manually_configured(hass):
|
||||
async def test_no_clients(hass):
|
||||
"""Test the update_clients function when no clients are found."""
|
||||
controller = await setup_unifi_integration(
|
||||
hass, options={CONF_TRACK_CLIENTS: False, CONF_TRACK_DEVICES: False},
|
||||
hass,
|
||||
options={CONF_TRACK_CLIENTS: False, CONF_TRACK_DEVICES: False},
|
||||
)
|
||||
|
||||
assert len(controller.mock_requests) == 4
|
||||
@@ -517,21 +518,24 @@ async def test_option_block_clients(hass):
|
||||
|
||||
# Remove the second switch again
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_BLOCK_CLIENT: [BLOCKED["mac"]]},
|
||||
controller.config_entry,
|
||||
options={CONF_BLOCK_CLIENT: [BLOCKED["mac"]]},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert len(hass.states.async_entity_ids(SWITCH_DOMAIN)) == 1
|
||||
|
||||
# Enable one and remove another one
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_BLOCK_CLIENT: [UNBLOCKED["mac"]]},
|
||||
controller.config_entry,
|
||||
options={CONF_BLOCK_CLIENT: [UNBLOCKED["mac"]]},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert len(hass.states.async_entity_ids(SWITCH_DOMAIN)) == 0
|
||||
|
||||
# Remove one
|
||||
hass.config_entries.async_update_entry(
|
||||
controller.config_entry, options={CONF_BLOCK_CLIENT: []},
|
||||
controller.config_entry,
|
||||
options={CONF_BLOCK_CLIENT: []},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert len(hass.states.async_entity_ids(SWITCH_DOMAIN)) == 0
|
||||
@@ -604,7 +608,9 @@ async def test_ignore_multiple_poe_clients_on_same_port(hass):
|
||||
clients will be transparently marked as having POE as well.
|
||||
"""
|
||||
controller = await setup_unifi_integration(
|
||||
hass, clients_response=POE_SWITCH_CLIENTS, devices_response=[DEVICE_1],
|
||||
hass,
|
||||
clients_response=POE_SWITCH_CLIENTS,
|
||||
devices_response=[DEVICE_1],
|
||||
)
|
||||
|
||||
assert len(controller.mock_requests) == 4
|
||||
|
||||
Reference in new issue
Block a user