Use DataUpdateCoordinator for canary (#40691)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Chris TalkingtonandPaulus Schoutsen authored and GitHub committed 2020-10-01 10:26:26 +02:00
1 parent 7285c7806f
commit d93141c1a9
9 files changed
+193 -162

No files matched your search

+8 -1
View File
@@ -1,4 +1,6 @@
"""The tests for the Canary sensor platform."""
from datetime import timedelta
from homeassistant.components.canary.const import DOMAIN, MANUFACTURER
from homeassistant.components.canary.sensor import (
ATTR_AIR_QUALITY,
@@ -16,11 +18,12 @@ from homeassistant.const import (
TEMP_CELSIUS,
)
from homeassistant.setup import async_setup_component
from homeassistant.util.dt import utcnow
from . import mock_device, mock_location, mock_reading
from tests.async_mock import patch
from tests.common import mock_device_registry, mock_registry
from tests.common import async_fire_time_changed, mock_device_registry, mock_registry
async def test_sensors_pro(hass, canary) -> None:
@@ -124,6 +127,8 @@ async def test_sensors_attributes_pro(hass, canary) -> None:
mock_reading("air_quality", "0.4"),
]
future = utcnow() + timedelta(seconds=30)
async_fire_time_changed(hass, future)
await hass.helpers.entity_component.async_update_entity(entity_id)
await hass.async_block_till_done()
@@ -137,6 +142,8 @@ async def test_sensors_attributes_pro(hass, canary) -> None:
mock_reading("air_quality", "1.0"),
]
future += timedelta(seconds=30)
async_fire_time_changed(hass, future)
await hass.helpers.entity_component.async_update_entity(entity_id)
await hass.async_block_till_done()