Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/surepetcare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ async def async_update(self, _: Any = None) -> None:
"""Get the latest data from Sure Petcare."""

try:
self.states = await self.surepy.get_entities()
self.states = await self.surepy.get_entities(refresh=True)
except SurePetcareError as error:
_LOGGER.error("Unable to fetch data: %s", error)
return
Expand Down
12 changes: 8 additions & 4 deletions tests/components/surepetcare/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
from . import MOCK_API_DATA


async def _mock_call(method, resource):
if method == "GET" and resource == MESTART_RESOURCE:
return {"data": 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"
):
with patch("surepy.SureAPIClient", autospec=True) as mock_client_class:
client = mock_client_class.return_value
client.resources = {MESTART_RESOURCE: {"data": MOCK_API_DATA}}
client.resources = {}
client.call = _mock_call
yield client
2 changes: 1 addition & 1 deletion tests/components/surepetcare/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}


async def test_binary_sensors(hass, surepetcare) -> None:
async def test_sensors(hass, surepetcare) -> None:
"""Test the generation of unique ids."""
assert await async_setup_component(hass, DOMAIN, MOCK_CONFIG)
await hass.async_block_till_done()
Expand Down