Refresh now() templates on second=0 (#42225)
This commit is contained in:
1 parent
4e917cf62c
commit
cb0c937b3e
2 files changed
+15
-11
No files matched your search
@@ -2172,15 +2172,17 @@ async def test_track_template_with_time_that_leaves_scope(hass):
|
||||
"time": True,
|
||||
}
|
||||
|
||||
# Verify we do not update a second time
|
||||
# if the state change happens
|
||||
# Verify we do not update before the minute rolls over
|
||||
callback_count_before_time_change = len(specific_runs)
|
||||
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=59))
|
||||
test_time = dt_util.utcnow().replace(second=1)
|
||||
async_fire_time_changed(hass, test_time)
|
||||
await hass.async_block_till_done()
|
||||
async_fire_time_changed(hass, test_time + timedelta(seconds=58))
|
||||
await hass.async_block_till_done()
|
||||
assert len(specific_runs) == callback_count_before_time_change
|
||||
|
||||
# Verify we do update on the next time change
|
||||
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=61))
|
||||
# Verify we do update on the next change of minute
|
||||
async_fire_time_changed(hass, test_time + timedelta(seconds=59))
|
||||
await hass.async_block_till_done()
|
||||
assert len(specific_runs) == callback_count_before_time_change + 1
|
||||
|
||||
|
||||
Reference in new issue
Block a user