2020-10-14 13:15:56 +00:00
|
|
|
"""Pytest module configuration."""
|
2021-04-13 09:54:03 +00:00
|
|
|
from unittest.mock import patch
|
2021-01-01 21:31:56 +00:00
|
|
|
|
2020-10-14 13:15:56 +00:00
|
|
|
import pytest
|
|
|
|
|
2021-04-13 09:54:03 +00:00
|
|
|
from .common import FakeDiscovery, build_device_mock
|
2020-10-14 13:15:56 +00:00
|
|
|
|
|
|
|
|
2021-04-13 09:54:03 +00:00
|
|
|
@pytest.fixture(autouse=True, name="discovery")
|
2020-10-14 13:15:56 +00:00
|
|
|
def discovery_fixture():
|
2021-04-13 09:54:03 +00:00
|
|
|
"""Patch the discovery object."""
|
|
|
|
with patch("homeassistant.components.gree.bridge.Discovery") as mock:
|
|
|
|
mock.return_value = FakeDiscovery()
|
2020-10-14 13:15:56 +00:00
|
|
|
yield mock
|
|
|
|
|
|
|
|
|
2021-04-13 09:54:03 +00:00
|
|
|
@pytest.fixture(autouse=True, name="device")
|
2020-10-14 13:15:56 +00:00
|
|
|
def device_fixture():
|
2021-04-13 09:54:03 +00:00
|
|
|
"""Patch the device search and bind."""
|
2020-10-14 13:15:56 +00:00
|
|
|
with patch(
|
|
|
|
"homeassistant.components.gree.bridge.Device",
|
|
|
|
return_value=build_device_mock(),
|
|
|
|
) as mock:
|
|
|
|
yield mock
|