Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add basic scanner tests #43

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Loading