mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 05:13:47 +01:00
Update UTs
This commit is contained in:
parent
2602ddc379
commit
10766f1e93
1 changed files with 5 additions and 5 deletions
|
@ -155,18 +155,18 @@ class ApplicationServiceSchedulerRecovererTestCase(unittest.TestCase):
|
|||
|
||||
def take_txn(*args, **kwargs):
|
||||
return defer.succeed(txns.pop(0))
|
||||
self.store.get_oldest_txn = Mock(side_effect=take_txn)
|
||||
self.store.get_oldest_unsent_txn = Mock(side_effect=take_txn)
|
||||
|
||||
self.recoverer.recover()
|
||||
# shouldn't have called anything prior to waiting for exp backoff
|
||||
self.assertEquals(0, self.store.get_oldest_txn.call_count)
|
||||
self.assertEquals(0, self.store.get_oldest_unsent_txn.call_count)
|
||||
txn.send = Mock(return_value=True)
|
||||
# wait for exp backoff
|
||||
self.clock.advance_time(2000)
|
||||
self.assertEquals(1, txn.send.call_count)
|
||||
self.assertEquals(1, txn.complete.call_count)
|
||||
# 2 because it needs to get None to know there are no more txns
|
||||
self.assertEquals(2, self.store.get_oldest_txn.call_count)
|
||||
self.assertEquals(2, self.store.get_oldest_unsent_txn.call_count)
|
||||
self.callback.assert_called_once_with(self.recoverer)
|
||||
self.assertEquals(self.recoverer.service, self.service)
|
||||
|
||||
|
@ -180,10 +180,10 @@ class ApplicationServiceSchedulerRecovererTestCase(unittest.TestCase):
|
|||
return defer.succeed(txns.pop(0))
|
||||
else:
|
||||
return defer.succeed(txn)
|
||||
self.store.get_oldest_txn = Mock(side_effect=take_txn)
|
||||
self.store.get_oldest_unsent_txn = Mock(side_effect=take_txn)
|
||||
|
||||
self.recoverer.recover()
|
||||
self.assertEquals(0, self.store.get_oldest_txn.call_count)
|
||||
self.assertEquals(0, self.store.get_oldest_unsent_txn.call_count)
|
||||
txn.send = Mock(return_value=False)
|
||||
self.clock.advance_time(2000)
|
||||
self.assertEquals(1, txn.send.call_count)
|
||||
|
|
Loading…
Reference in a new issue