summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/changes/VERSION_COMPAT10
-rw-r--r--common/changes/feature_adapt-to-new-events-on-common1
-rw-r--r--common/src/leap/soledad/common/tests/test_soledad.py82
3 files changed, 52 insertions, 41 deletions
diff --git a/common/changes/VERSION_COMPAT b/common/changes/VERSION_COMPAT
index e69de29b..cc00ecf7 100644
--- a/common/changes/VERSION_COMPAT
+++ b/common/changes/VERSION_COMPAT
@@ -0,0 +1,10 @@
+#################################################
+# This file keeps track of the recent changes
+# introduced in internal leap dependencies.
+# Add your changes here so we can properly update
+# requirements.pip during the release process.
+# (leave header when resetting)
+#################################################
+#
+# BEGIN DEPENDENCY LIST -------------------------
+# leap.foo.bar>=x.y.z
diff --git a/common/changes/feature_adapt-to-new-events-on-common b/common/changes/feature_adapt-to-new-events-on-common
new file mode 100644
index 00000000..cd55fa7d
--- /dev/null
+++ b/common/changes/feature_adapt-to-new-events-on-common
@@ -0,0 +1 @@
+- Adapt soledad to the new events api on leap.common. Related to #6359.
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()