hass-core/tests/components/surepetcare/conftest.py
Will Hughes a6e474c7c9
Update surepy to v0.4.0 (#44556)
* Update surepy to v0.4.0

* Clarify pylint disable

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-01-02 03:52:33 +01:00

22 lines
720 B
Python

"""Define fixtures available for all tests."""
from unittest.mock import AsyncMock, patch
from pytest import fixture
from surepy import SurePetcare
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@fixture
async def surepetcare(hass):
"""Mock the SurePetcare for easier testing."""
with patch("homeassistant.components.surepetcare.SurePetcare") as mock_surepetcare:
instance = mock_surepetcare.return_value = SurePetcare(
"test-username",
"test-password",
hass.loop,
async_get_clientsession(hass),
api_timeout=1,
)
instance._get_resource = AsyncMock(return_value=None)
yield mock_surepetcare