hass-core/tests/components/obihai/conftest.py
Emory Penney 7c6a32ebb5
Add DHCP discovery to Obihai (#88984)
* Add DHCP discovery to Obihai

* Unique ID is MAC

* Move try blocks, cleanup

* Migrate existing unique_ids

* Use PyObihai to update Unique ID

* Auth then use get_device_mac

* Config flow changes

* Reworking flow according to feedback

* Cleanup
2023-04-03 21:17:56 +02:00

28 lines
723 B
Python

"""Define test fixtures for Obihai."""
from collections.abc import Generator
from socket import gaierror
from unittest.mock import AsyncMock, patch
import pytest
@pytest.fixture
def mock_setup_entry() -> Generator[AsyncMock, None, None]:
"""Override async_setup_entry."""
with patch(
"homeassistant.components.obihai.async_setup_entry", return_value=True
) as mock_setup_entry:
yield mock_setup_entry
@pytest.fixture
def mock_gaierror() -> Generator[AsyncMock, None, None]:
"""Override async_setup_entry."""
with patch(
"homeassistant.components.obihai.config_flow.gethostbyname",
side_effect=gaierror(),
) as mock_setup_entry:
yield mock_setup_entry