Files
core/tests/components/quantum_gateway/conftest.py
Tamer Wahba d870410413 Quantum Gateway device tracker tests (#145161)
* move constants to central const file

* add none return type to device scanner constructor

* add quantum gateway device tracker tests

* fix

---------

Co-authored-by: Joostlek <joostlek@outlook.com>
2025-05-22 12:18:56 +02:00

24 lines
738 B
Python

"""Fixtures for Quantum Gateway tests."""
from collections.abc import Generator
from unittest.mock import AsyncMock, patch
import pytest
@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