mirror of
https://github.com/home-assistant/core.git
synced 2026-05-22 08:20:04 +01:00
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
"""Fixtures for Quantum Gateway tests."""
|
|
|
|
from collections.abc import Generator
|
|
from unittest.mock import AsyncMock, patch
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def hass_config_dir(hass_tmp_config_dir: str) -> str:
|
|
"""Use temporary config directory for device_tracker tests.
|
|
|
|
This fixture can be removed when the legacy YAML writing has been removed
|
|
from the device tracker integration.
|
|
"""
|
|
return hass_tmp_config_dir
|
|
|
|
|
|
@pytest.fixture
|
|
async def mock_scanner() -> Generator[AsyncMock]:
|
|
"""Mock QuantumGatewayScanner instance."""
|
|
with patch(
|
|
"homeassistant.components.quantum_gateway.device_tracker.QuantumGatewayScanner",
|
|
autospec=True,
|
|
) as mock_scanner:
|
|
client = mock_scanner.return_value
|
|
client.success_init = True
|
|
client.scan_devices.return_value = ["ff:ff:ff:ff:ff:ff", "ff:ff:ff:ff:ff:fe"]
|
|
client.get_device_name.side_effect = {
|
|
"ff:ff:ff:ff:ff:ff": "",
|
|
"ff:ff:ff:ff:ff:fe": "desktop",
|
|
}.get
|
|
yield mock_scanner
|