1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Bump bluetooth deps for bleak 0.20 (#89925)

Co-authored-by: K <z@kwi.li>
This commit is contained in:
J. Nick Koston
2023-03-20 01:06:15 -10:00
committed by GitHub
parent f3b3818d1f
commit c3043fb0ee
35 changed files with 347 additions and 258 deletions

View File

@@ -24,6 +24,7 @@ from . import (
MockBleakClient,
_get_manager,
generate_advertisement_data,
generate_ble_device,
inject_advertisement,
inject_advertisement_with_source,
)
@@ -34,7 +35,7 @@ async def test_wrapped_bleak_scanner(
) -> None:
"""Test wrapped bleak scanner dispatches calls as expected."""
scanner = HaBleakScannerWrapper()
switchbot_device = BLEDevice("44:44:33:11:23:45", "wohand")
switchbot_device = generate_ble_device("44:44:33:11:23:45", "wohand")
switchbot_adv = generate_advertisement_data(
local_name="wohand", service_uuids=[], manufacturer_data={1: b"\x01"}
)
@@ -47,7 +48,7 @@ async def test_wrapped_bleak_client_raises_device_missing(
hass: HomeAssistant, enable_bluetooth: None
) -> None:
"""Test wrapped bleak client dispatches calls as expected."""
switchbot_device = BLEDevice("44:44:33:11:23:45", "wohand")
switchbot_device = generate_ble_device("44:44:33:11:23:45", "wohand")
client = HaBleakClientWrapper(switchbot_device)
assert client.is_connected is False
with pytest.raises(bleak.BleakError):
@@ -61,7 +62,7 @@ async def test_wrapped_bleak_client_set_disconnected_callback_before_connected(
hass: HomeAssistant, enable_bluetooth: None
) -> None:
"""Test wrapped bleak client can set a disconnected callback before connected."""
switchbot_device = BLEDevice("44:44:33:11:23:45", "wohand")
switchbot_device = generate_ble_device("44:44:33:11:23:45", "wohand")
client = HaBleakClientWrapper(switchbot_device)
client.set_disconnected_callback(lambda client: None)
@@ -72,7 +73,7 @@ async def test_wrapped_bleak_client_local_adapter_only(
"""Test wrapped bleak client with only a local adapter."""
manager = _get_manager()
switchbot_device = BLEDevice(
switchbot_device = generate_ble_device(
"44:44:33:11:23:45",
"wohand",
{"path": "/org/bluez/hci0/dev_44_44_33_11_23_45"},
@@ -133,7 +134,7 @@ async def test_wrapped_bleak_client_set_disconnected_callback_after_connected(
"""Test wrapped bleak client can set a disconnected callback after connected."""
manager = _get_manager()
switchbot_proxy_device_has_connection_slot = BLEDevice(
switchbot_proxy_device_has_connection_slot = generate_ble_device(
"44:44:33:11:23:45",
"wohand",
{
@@ -148,7 +149,7 @@ async def test_wrapped_bleak_client_set_disconnected_callback_after_connected(
manufacturer_data={1: b"\x01"},
rssi=-40,
)
switchbot_device = BLEDevice(
switchbot_device = generate_ble_device(
"44:44:33:11:23:45",
"wohand",
{"path": "/org/bluez/hci0/dev_44_44_33_11_23_45"},
@@ -220,7 +221,7 @@ async def test_ble_device_with_proxy_client_out_of_connections_no_scanners(
"""Test we switch to the next available proxy when one runs out of connections with no scanners."""
manager = _get_manager()
switchbot_proxy_device_no_connection_slot = BLEDevice(
switchbot_proxy_device_no_connection_slot = generate_ble_device(
"44:44:33:11:23:45",
"wohand",
{
@@ -257,7 +258,7 @@ async def test_ble_device_with_proxy_client_out_of_connections(
"""Test handling all scanners are out of connection slots."""
manager = _get_manager()
switchbot_proxy_device_no_connection_slot = BLEDevice(
switchbot_proxy_device_no_connection_slot = generate_ble_device(
"44:44:33:11:23:45",
"wohand",
{
@@ -322,7 +323,7 @@ async def test_ble_device_with_proxy_clear_cache(
"""Test we can clear cache on the proxy."""
manager = _get_manager()
switchbot_proxy_device_with_connection_slot = BLEDevice(
switchbot_proxy_device_with_connection_slot = generate_ble_device(
"44:44:33:11:23:45",
"wohand",
{
@@ -384,7 +385,7 @@ async def test_ble_device_with_proxy_client_out_of_connections_uses_best_availab
"""Test we switch to the next available proxy when one runs out of connections."""
manager = _get_manager()
switchbot_proxy_device_no_connection_slot = BLEDevice(
switchbot_proxy_device_no_connection_slot = generate_ble_device(
"44:44:33:11:23:45",
"wohand",
{
@@ -398,7 +399,7 @@ async def test_ble_device_with_proxy_client_out_of_connections_uses_best_availab
manufacturer_data={1: b"\x01"},
rssi=-30,
)
switchbot_proxy_device_has_connection_slot = BLEDevice(
switchbot_proxy_device_has_connection_slot = generate_ble_device(
"44:44:33:11:23:45",
"wohand",
{
@@ -413,7 +414,7 @@ async def test_ble_device_with_proxy_client_out_of_connections_uses_best_availab
manufacturer_data={1: b"\x01"},
rssi=-40,
)
switchbot_device = BLEDevice(
switchbot_device = generate_ble_device(
"44:44:33:11:23:45",
"wohand",
{"path": "/org/bluez/hci0/dev_44_44_33_11_23_45"},
@@ -493,7 +494,7 @@ async def test_ble_device_with_proxy_client_out_of_connections_uses_best_availab
"""Test we switch to the next available proxy when one runs out of connections on MacOS."""
manager = _get_manager()
switchbot_proxy_device_no_connection_slot = BLEDevice(
switchbot_proxy_device_no_connection_slot = generate_ble_device(
"44:44:33:11:23:45",
"wohand_no_connection_slot",
{
@@ -509,7 +510,7 @@ async def test_ble_device_with_proxy_client_out_of_connections_uses_best_availab
manufacturer_data={1: b"\x01"},
rssi=-30,
)
switchbot_proxy_device_has_connection_slot = BLEDevice(
switchbot_proxy_device_has_connection_slot = generate_ble_device(
"44:44:33:11:23:45",
"wohand_has_connection_slot",
{
@@ -525,7 +526,7 @@ async def test_ble_device_with_proxy_client_out_of_connections_uses_best_availab
rssi=-40,
)
switchbot_device = BLEDevice(
switchbot_device = generate_ble_device(
"44:44:33:11:23:45",
"wohand",
{},