diff options
author | NavaL <ayoyo@thoughtworks.com> | 2016-06-20 18:30:44 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2016-06-22 16:38:45 +0200 |
commit | f3adea709a3e33451977b1807fd2dda207af2743 (patch) | |
tree | b9e088814e85a866140299a3fe3a0ddf93069720 /common | |
parent | ab37460772c3cf07c6915baf42a61a44156cfde2 (diff) |
[bug] fix test processing order
This moves the reactor time to the loopingcall period.
This is necessary as the decryption is now deferred to a thread.
The test will exit before the task is executed otherwise.
Diffstat (limited to 'common')
-rw-r--r-- | common/src/leap/soledad/common/tests/test_encdecpool.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/src/leap/soledad/common/tests/test_encdecpool.py b/common/src/leap/soledad/common/tests/test_encdecpool.py index 9d98f44d..e6ad66ca 100644 --- a/common/src/leap/soledad/common/tests/test_encdecpool.py +++ b/common/src/leap/soledad/common/tests/test_encdecpool.py @@ -29,6 +29,7 @@ from leap.soledad.client.encdecpool import SyncDecrypterPool from leap.soledad.common.document import SoledadDocument from leap.soledad.common.tests.util import BaseSoledadTest from twisted.internet import defer +from twisted.test.proto_helpers import MemoryReactorClock DOC_ID = "mydoc" DOC_REV = "rev" @@ -217,7 +218,11 @@ class TestSyncDecrypterPool(BaseSoledadTest): This test ensures that processing of documents only occur if there is a sequence in place. """ + reactor_clock = MemoryReactorClock() + self._pool._loop.clock = reactor_clock + crypto = self._soledad._crypto + docs = [] for i in xrange(1, 10): i = str(i) @@ -239,6 +244,7 @@ class TestSyncDecrypterPool(BaseSoledadTest): yield self._pool.insert_encrypted_received_doc( doc.doc_id, doc.rev, encrypted_content, 10, "trans_id", 10) + reactor_clock.advance(self._pool.DECRYPT_LOOP_PERIOD) yield self._pool._decrypt_and_recurse() self.assertEqual(3, self._pool._processed_docs) |