Use DataUpdateCoordinator for canary (#40691)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
1 parent
7285c7806f
commit
d93141c1a9
9 files changed
+193
-162
No files matched your search
@@ -5,17 +5,12 @@ from pytest import fixture
|
||||
from tests.async_mock import MagicMock, patch
|
||||
|
||||
|
||||
def mock_canary_update(self, **kwargs):
|
||||
"""Get the latest data from py-canary."""
|
||||
self._update(**kwargs)
|
||||
|
||||
|
||||
@fixture
|
||||
def canary(hass):
|
||||
"""Mock the CanaryApi for easier testing."""
|
||||
with patch.object(Api, "login", return_value=True), patch(
|
||||
"homeassistant.components.canary.CanaryData.update", mock_canary_update
|
||||
), patch("homeassistant.components.canary.Api") as mock_canary:
|
||||
"homeassistant.components.canary.Api"
|
||||
) as mock_canary:
|
||||
instance = mock_canary.return_value = Api(
|
||||
"test-username",
|
||||
"test-password",
|
||||
|
||||
Reference in new issue
Block a user