1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Use DataUpdateCoordinator for canary (#40691)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Chris Talkington
2020-10-01 03:26:26 -05:00
committed by GitHub
parent 7285c7806f
commit d93141c1a9
9 changed files with 193 additions and 162 deletions

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()