1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-27 12:14:35 +01:00

Accept advertisements from alternate scanners when a scanner stops scanning (#82448)

This commit is contained in:
J. Nick Koston
2022-11-21 20:23:07 -06:00
committed by GitHub
parent dfed57ed4d
commit a7caa038be
14 changed files with 275 additions and 68 deletions

View File

@@ -0,0 +1,16 @@
"""Tests for the Bluetooth integration API."""
from homeassistant.components import bluetooth
from homeassistant.components.bluetooth import BaseHaScanner, async_scanner_by_source
async def test_scanner_by_source(hass, enable_bluetooth):
"""Test we can get a scanner by source."""
hci2_scanner = BaseHaScanner(hass, "hci2", "hci2")
cancel_hci2 = bluetooth.async_register_scanner(hass, hci2_scanner, True)
assert async_scanner_by_source(hass, "hci2") is hci2_scanner
cancel_hci2()
assert async_scanner_by_source(hass, "hci2") is None