core/tests/components/surepetcare/conftest.py

19 lines
511 B
Python
Raw Normal View History

"""Define fixtures available for all tests."""
from unittest.mock import patch
2021-01-01 21:31:56 +00:00
import pytest
from surepy import MESTART_RESOURCE
from . import MOCK_API_DATA
@pytest.fixture
async def surepetcare():
"""Mock the SurePetcare for easier testing."""
with patch("surepy.SureAPIClient", autospec=True) as mock_client_class, patch(
"surepy.find_token"
):
client = mock_client_class.return_value
client.resources = {MESTART_RESOURCE: {"data": MOCK_API_DATA}}
yield client