tests: #11 add test for __call__
Add test for __call__ in ExtendedLoopingCall class Test __call__ modifies start_delay and starttime if start_delay was previously set
This commit is contained in:
parent
f31b954bd7
commit
d044e31f08
1 changed files with 13 additions and 0 deletions
|
|
@ -150,6 +150,19 @@ class TestExtendedLoopingCall(TestCase):
|
||||||
loopcall = ExtendedLoopingCall(callback)
|
loopcall = ExtendedLoopingCall(callback)
|
||||||
loopcall.start(-1, now=True, start_delay=None, count_start=1)
|
loopcall.start(-1, now=True, start_delay=None, count_start=1)
|
||||||
|
|
||||||
|
def test__call__when_delay(self):
|
||||||
|
""" Test __call__ modifies start_delay and starttime if start_delay was previously set """
|
||||||
|
callback = mock.MagicMock()
|
||||||
|
loopcall = ExtendedLoopingCall(callback)
|
||||||
|
loopcall.clock.seconds = mock.MagicMock(return_value=1)
|
||||||
|
loopcall.start_delay = 2
|
||||||
|
loopcall.starttime = 0
|
||||||
|
|
||||||
|
loopcall()
|
||||||
|
|
||||||
|
self.assertEqual(loopcall.start_delay, None)
|
||||||
|
self.assertEqual(loopcall.starttime, 1)
|
||||||
|
|
||||||
def dummy_func():
|
def dummy_func():
|
||||||
return 0
|
return 0
|
||||||
class TestMonitorHandler(TestCase):
|
class TestMonitorHandler(TestCase):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue