1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

Refactor all Bluetooth scanners to inherit from BaseHaRemoteScanner (#105523)

This commit is contained in:
J. Nick Koston
2023-12-12 10:28:43 -10:00
committed by GitHub
parent 5bd0833f49
commit f002a6a732
16 changed files with 83 additions and 165 deletions

View File

@@ -8,8 +8,8 @@ from habluetooth import HaScanner
from homeassistant.components import bluetooth
from homeassistant.components.bluetooth import (
MONOTONIC_TIME,
BaseHaRemoteScanner,
HaBluetoothConnector,
HomeAssistantRemoteScanner,
)
from homeassistant.core import HomeAssistant
@@ -423,7 +423,7 @@ async def test_diagnostics_remote_adapter(
local_name="wohand", service_uuids=[], manufacturer_data={1: b"\x01"}
)
class FakeScanner(HomeAssistantRemoteScanner):
class FakeScanner(BaseHaRemoteScanner):
def inject_advertisement(
self, device: BLEDevice, advertisement_data: AdvertisementData
) -> None:
@@ -458,9 +458,7 @@ async def test_diagnostics_remote_adapter(
connector = (
HaBluetoothConnector(MockBleakClient, "mock_bleak_client", lambda: False),
)
scanner = FakeScanner(
hass, "esp32", "esp32", new_info_callback, connector, False
)
scanner = FakeScanner("esp32", "esp32", new_info_callback, connector, False)
unsetup = scanner.async_setup()
cancel = manager.async_register_scanner(scanner, True)
@@ -631,7 +629,6 @@ async def test_diagnostics_remote_adapter(
"scanning": True,
"source": "esp32",
"start_time": ANY,
"storage": None,
"time_since_last_device_detection": {"44:44:33:11:23:45": ANY},
"type": "FakeScanner",
},