Skip to content

Commit

Permalink
chore: add basic scanner tests (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Dec 22, 2024
1 parent 2ae19b4 commit 3dee0a0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Empty file added tests/backend/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions tests/backend/test_scanner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from habluetooth import (
BaseHaRemoteScanner,
HaBluetoothConnector,
)

from bleak_esphome.backend.client import ESPHomeClientData
from bleak_esphome.backend.scanner import ESPHomeScanner

ESP_MAC_ADDRESS = "AA:BB:CC:DD:EE:FF"
ESP_NAME = "proxy"


def test_scanner():
connector = HaBluetoothConnector(ESPHomeClientData, ESP_MAC_ADDRESS, lambda: True)
scanner = ESPHomeScanner(ESP_MAC_ADDRESS, ESP_NAME, connector, True)
assert isinstance(scanner, BaseHaRemoteScanner)
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pytest
from bleak_retry_connector import BleakSlotManager
from bluetooth_adapters import BluetoothAdapters
from habluetooth import (
BluetoothManager,
set_manager,
)


@pytest.fixture(scope="session", autouse=True)
def manager():
slot_manager = BleakSlotManager()
bluetooth_adapters = BluetoothAdapters()
set_manager(BluetoothManager(bluetooth_adapters, slot_manager))

0 comments on commit 3dee0a0

Please sign in to comment.