diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-05-06 17:42:26 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-05-27 12:02:39 -0300 |
commit | 7d4ab674a167d48686f61310ff4ff6a62a545e67 (patch) | |
tree | d8ed270d0a73c50eb65f392f231c5c3107473058 /common/src/leap/soledad | |
parent | 91674a40edb19cd241c76b27ad998bb5df404570 (diff) |
[feat] adapt to new events api on common
- Related: #6359
Diffstat (limited to 'common/src/leap/soledad')
-rw-r--r-- | common/src/leap/soledad/common/tests/test_soledad.py | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/common/src/leap/soledad/common/tests/test_soledad.py b/common/src/leap/soledad/common/tests/test_soledad.py index 0b49d9f5..1cd74dad 100644 --- a/common/src/leap/soledad/common/tests/test_soledad.py +++ b/common/src/leap/soledad/common/tests/test_soledad.py @@ -20,7 +20,7 @@ Tests for general Soledad functionality. import os from mock import Mock -from leap.common.events import events_pb2 as proto +from leap.common.events import catalog from leap.soledad.common.tests.util import ( BaseSoledadTest, ADDRESS, @@ -218,7 +218,7 @@ class SoledadSignalingTestCase(BaseSoledadTest): def setUp(self): # mock signaling soledad.client.signal = Mock() - soledad.client.secrets.events.signal = Mock() + soledad.client.secrets.events.emit = Mock() # run parent's setUp BaseSoledadTest.setUp(self) @@ -240,58 +240,58 @@ class SoledadSignalingTestCase(BaseSoledadTest): - downloading keys / done downloading keys. - uploading keys / done uploading keys. """ - soledad.client.secrets.events.signal.reset_mock() + soledad.client.secrets.events.emit.reset_mock() # get a fresh instance so it emits all bootstrap signals sol = self._soledad_instance( secrets_path='alternative_stage3.json', local_db_path='alternative_stage3.u1db') # reverse call order so we can verify in the order the signals were # expected - soledad.client.secrets.events.signal.mock_calls.reverse() - soledad.client.secrets.events.signal.call_args = \ - soledad.client.secrets.events.signal.call_args_list[0] - soledad.client.secrets.events.signal.call_args_list.reverse() + soledad.client.secrets.events.emit.mock_calls.reverse() + soledad.client.secrets.events.emit.call_args = \ + soledad.client.secrets.events.emit.call_args_list[0] + soledad.client.secrets.events.emit.call_args_list.reverse() # downloading keys signals - soledad.client.secrets.events.signal.assert_called_with( - proto.SOLEDAD_DOWNLOADING_KEYS, + soledad.client.secrets.events.emit.assert_called_with( + catalog.SOLEDAD_DOWNLOADING_KEYS, ADDRESS, ) - self._pop_mock_call(soledad.client.secrets.events.signal) - soledad.client.secrets.events.signal.assert_called_with( - proto.SOLEDAD_DONE_DOWNLOADING_KEYS, + self._pop_mock_call(soledad.client.secrets.events.emit) + soledad.client.secrets.events.emit.assert_called_with( + catalog.SOLEDAD_DONE_DOWNLOADING_KEYS, ADDRESS, ) # creating keys signals - self._pop_mock_call(soledad.client.secrets.events.signal) - soledad.client.secrets.events.signal.assert_called_with( - proto.SOLEDAD_CREATING_KEYS, + self._pop_mock_call(soledad.client.secrets.events.emit) + soledad.client.secrets.events.emit.assert_called_with( + catalog.SOLEDAD_CREATING_KEYS, ADDRESS, ) - self._pop_mock_call(soledad.client.secrets.events.signal) - soledad.client.secrets.events.signal.assert_called_with( - proto.SOLEDAD_DONE_CREATING_KEYS, + self._pop_mock_call(soledad.client.secrets.events.emit) + soledad.client.secrets.events.emit.assert_called_with( + catalog.SOLEDAD_DONE_CREATING_KEYS, ADDRESS, ) # downloading once more (inside _put_keys_in_shared_db) - self._pop_mock_call(soledad.client.secrets.events.signal) - soledad.client.secrets.events.signal.assert_called_with( - proto.SOLEDAD_DOWNLOADING_KEYS, + self._pop_mock_call(soledad.client.secrets.events.emit) + soledad.client.secrets.events.emit.assert_called_with( + catalog.SOLEDAD_DOWNLOADING_KEYS, ADDRESS, ) - self._pop_mock_call(soledad.client.secrets.events.signal) - soledad.client.secrets.events.signal.assert_called_with( - proto.SOLEDAD_DONE_DOWNLOADING_KEYS, + self._pop_mock_call(soledad.client.secrets.events.emit) + soledad.client.secrets.events.emit.assert_called_with( + catalog.SOLEDAD_DONE_DOWNLOADING_KEYS, ADDRESS, ) # uploading keys signals - self._pop_mock_call(soledad.client.secrets.events.signal) - soledad.client.secrets.events.signal.assert_called_with( - proto.SOLEDAD_UPLOADING_KEYS, + self._pop_mock_call(soledad.client.secrets.events.emit) + soledad.client.secrets.events.emit.assert_called_with( + catalog.SOLEDAD_UPLOADING_KEYS, ADDRESS, ) - self._pop_mock_call(soledad.client.secrets.events.signal) - soledad.client.secrets.events.signal.assert_called_with( - proto.SOLEDAD_DONE_UPLOADING_KEYS, + self._pop_mock_call(soledad.client.secrets.events.emit) + soledad.client.secrets.events.emit.assert_called_with( + catalog.SOLEDAD_DONE_UPLOADING_KEYS, ADDRESS, ) # assert db was locked and unlocked @@ -311,7 +311,7 @@ class SoledadSignalingTestCase(BaseSoledadTest): doc.content = sol.secrets._export_recovery_document() sol.close() # reset mock - soledad.client.secrets.events.signal.reset_mock() + soledad.client.secrets.events.emit.reset_mock() # get a fresh instance so it emits all bootstrap signals shared_db = self.get_default_shared_mock(get_doc_return_value=doc) sol = self._soledad_instance( @@ -320,18 +320,18 @@ class SoledadSignalingTestCase(BaseSoledadTest): shared_db_class=shared_db) # reverse call order so we can verify in the order the signals were # expected - soledad.client.secrets.events.signal.mock_calls.reverse() - soledad.client.secrets.events.signal.call_args = \ - soledad.client.secrets.events.signal.call_args_list[0] - soledad.client.secrets.events.signal.call_args_list.reverse() + soledad.client.secrets.events.emit.mock_calls.reverse() + soledad.client.secrets.events.emit.call_args = \ + soledad.client.secrets.events.emit.call_args_list[0] + soledad.client.secrets.events.emit.call_args_list.reverse() # assert download keys signals - soledad.client.secrets.events.signal.assert_called_with( - proto.SOLEDAD_DOWNLOADING_KEYS, + soledad.client.secrets.events.emit.assert_called_with( + catalog.SOLEDAD_DOWNLOADING_KEYS, ADDRESS, ) - self._pop_mock_call(soledad.client.secrets.events.signal) - soledad.client.secrets.events.signal.assert_called_with( - proto.SOLEDAD_DONE_DOWNLOADING_KEYS, + self._pop_mock_call(soledad.client.secrets.events.emit) + soledad.client.secrets.events.emit.assert_called_with( + catalog.SOLEDAD_DONE_DOWNLOADING_KEYS, ADDRESS, ) sol.close() @@ -360,7 +360,7 @@ class SoledadSignalingTestCase(BaseSoledadTest): def _assert_done_data_sync_signal_emitted(results): # assert the signal has been emitted soledad.client.signal.assert_called_with( - proto.SOLEDAD_DONE_DATA_SYNC, + catalog.SOLEDAD_DONE_DATA_SYNC, ADDRESS, ) sol.close() |