Tests: #11 test force_repeat

Test forcing script to run that is scheduled to run in the future
This commit is contained in:
Storsorken 2023-03-06 01:24:22 +01:00
parent d044e31f08
commit 2e4bced351

View file

@ -163,6 +163,17 @@ class TestExtendedLoopingCall(TestCase):
self.assertEqual(loopcall.start_delay, None)
self.assertEqual(loopcall.starttime, 1)
def test_force_repeat(self):
""" Test forcing script to run that is scheduled to run in the future """
callback = mock.MagicMock()
loopcall = ExtendedLoopingCall(callback)
loopcall.clock.seconds = mock.MagicMock(return_value=0)
loopcall.start(20, now=False, start_delay=5, count_start=0)
loopcall.force_repeat()
callback.assert_called_once()
def dummy_func():
return 0
class TestMonitorHandler(TestCase):