mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Attempt to fix flaky nam test (#64613)
This commit is contained in:
parent
3575009330
commit
b3cda6b681
@ -54,7 +54,10 @@ async def test_sensor(hass):
|
|||||||
disabled_by=None,
|
disabled_by=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
await init_integration(hass)
|
# Patch return value from utcnow, with offset to make sure the patch is correct
|
||||||
|
now = utcnow() - timedelta(hours=1)
|
||||||
|
with patch("homeassistant.components.nam.sensor.utcnow", return_value=now):
|
||||||
|
await init_integration(hass)
|
||||||
|
|
||||||
state = hass.states.get("sensor.nettigo_air_monitor_bme280_humidity")
|
state = hass.states.get("sensor.nettigo_air_monitor_bme280_humidity")
|
||||||
assert state
|
assert state
|
||||||
@ -217,7 +220,7 @@ async def test_sensor(hass):
|
|||||||
assert state
|
assert state
|
||||||
assert (
|
assert (
|
||||||
state.state
|
state.state
|
||||||
== (utcnow() - timedelta(seconds=456987)).replace(microsecond=0).isoformat()
|
== (now - timedelta(seconds=456987)).replace(microsecond=0).isoformat()
|
||||||
)
|
)
|
||||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TIMESTAMP
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TIMESTAMP
|
||||||
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
assert state.attributes.get(ATTR_STATE_CLASS) is None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user