hass-core/tests/components/gree/conftest.py
Clifford Roche 839b9f226e
Add gree climate integration ()
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-10-14 15:15:56 +02:00

36 lines
933 B
Python

"""Pytest module configuration."""
import pytest
from .common import build_device_info_mock, build_device_mock
from tests.async_mock import AsyncMock, patch
@pytest.fixture(name="discovery")
def discovery_fixture():
"""Patch the discovery service."""
with patch(
"homeassistant.components.gree.bridge.Discovery.search_devices",
new_callable=AsyncMock,
return_value=[build_device_info_mock()],
) as mock:
yield mock
@pytest.fixture(name="device")
def device_fixture():
"""Path the device search and bind."""
with patch(
"homeassistant.components.gree.bridge.Device",
return_value=build_device_mock(),
) as mock:
yield mock
@pytest.fixture(name="setup")
def setup_fixture():
"""Patch the climate setup."""
with patch(
"homeassistant.components.gree.climate.async_setup_entry", return_value=True
) as setup:
yield setup