mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Restore history from bluetooth stack at startup (#78612)
This commit is contained in:
@@ -1,10 +1,20 @@
|
||||
"""Tests for the bluetooth component."""
|
||||
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(name="bluez_dbus_mock")
|
||||
def bluez_dbus_mock():
|
||||
"""Fixture that mocks out the bluez dbus calls."""
|
||||
# Must patch directly since this is loaded on demand only
|
||||
with patch(
|
||||
"bluetooth_adapters.BlueZDBusObjects", return_value=MagicMock(load=AsyncMock())
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture(name="macos_adapter")
|
||||
def macos_adapter():
|
||||
"""Fixture that mocks the macos adapter."""
|
||||
@@ -25,7 +35,7 @@ def windows_adapter():
|
||||
|
||||
|
||||
@pytest.fixture(name="one_adapter")
|
||||
def one_adapter_fixture():
|
||||
def one_adapter_fixture(bluez_dbus_mock):
|
||||
"""Fixture that mocks one adapter on Linux."""
|
||||
with patch(
|
||||
"homeassistant.components.bluetooth.platform.system", return_value="Linux"
|
||||
@@ -54,7 +64,7 @@ def one_adapter_fixture():
|
||||
|
||||
|
||||
@pytest.fixture(name="two_adapters")
|
||||
def two_adapters_fixture():
|
||||
def two_adapters_fixture(bluez_dbus_mock):
|
||||
"""Fixture that mocks two adapters on Linux."""
|
||||
with patch(
|
||||
"homeassistant.components.bluetooth.platform.system", return_value="Linux"
|
||||
|
||||
Reference in New Issue
Block a user