2020-08-25 11:34:14 -05:00
|
|
|
"""Define fixtures available for all tests."""
|
2021-04-27 20:58:52 +02:00
|
|
|
from unittest.mock import patch
|
2021-01-01 22:31:56 +01:00
|
|
|
|
2021-04-27 20:58:52 +02:00
|
|
|
import pytest
|
|
|
|
from surepy import MESTART_RESOURCE
|
2020-08-25 11:34:14 -05:00
|
|
|
|
2021-04-27 20:58:52 +02:00
|
|
|
from . import MOCK_API_DATA
|
2020-08-25 11:34:14 -05:00
|
|
|
|
|
|
|
|
2021-04-27 20:58:52 +02:00
|
|
|
@pytest.fixture
|
|
|
|
async def surepetcare():
|
2020-08-25 11:34:14 -05:00
|
|
|
"""Mock the SurePetcare for easier testing."""
|
2021-04-27 20:58:52 +02:00
|
|
|
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
|