mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 10:59:40 +00:00
Include HKC BLE MAC in device info when available (#141900)
* Include HKC BLE MAC in device info when available * update tests * cover * dry * dry * dry
This commit is contained in:
@@ -4,7 +4,9 @@ from collections.abc import Callable, Generator
|
||||
import datetime
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from aiohomekit.testing import FakeController
|
||||
from aiohomekit.model import Transport
|
||||
from aiohomekit.testing import FakeController, FakeDiscovery, FakePairing
|
||||
from bleak.backends.device import BLEDevice
|
||||
from freezegun import freeze_time
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
@@ -57,3 +59,31 @@ def get_next_aid() -> Generator[Callable[[], int]]:
|
||||
return id_counter
|
||||
|
||||
return _get_id
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fake_ble_discovery() -> Generator[None]:
|
||||
"""Fake BLE discovery."""
|
||||
|
||||
class FakeBLEDiscovery(FakeDiscovery):
|
||||
device = BLEDevice(
|
||||
address="AA:BB:CC:DD:EE:FF", name="TestDevice", rssi=-50, details=()
|
||||
)
|
||||
|
||||
with patch("aiohomekit.testing.FakeDiscovery", FakeBLEDiscovery):
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fake_ble_pairing() -> Generator[None]:
|
||||
"""Fake BLE pairing."""
|
||||
|
||||
class FakeBLEPairing(FakePairing):
|
||||
"""Fake BLE pairing."""
|
||||
|
||||
@property
|
||||
def transport(self):
|
||||
return Transport.BLE
|
||||
|
||||
with patch("aiohomekit.testing.FakePairing", FakeBLEPairing):
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user