summaryrefslogtreecommitdiff
path: root/common/src/leap/soledad
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-12-14 10:12:15 -0400
committerKali Kaneko <kali@leap.se>2015-12-14 10:12:37 -0400
commita750a80d35b19d1d8bd410c194531b8b92c6eb96 (patch)
tree5a3b7a7ea9a743a38cf104d140a52fa3db25af24 /common/src/leap/soledad
parent402e00bbd3dd98363ce7ffa31cb9aeae1490095e (diff)
[bug] fix failing tests after last events modification
Diffstat (limited to 'common/src/leap/soledad')
-rw-r--r--common/src/leap/soledad/common/tests/test_soledad.py36
-rw-r--r--common/src/leap/soledad/common/tests/util.py7
2 files changed, 21 insertions, 22 deletions
diff --git a/common/src/leap/soledad/common/tests/test_soledad.py b/common/src/leap/soledad/common/tests/test_soledad.py
index 85d6734e..a2375b6e 100644
--- a/common/src/leap/soledad/common/tests/test_soledad.py
+++ b/common/src/leap/soledad/common/tests/test_soledad.py
@@ -249,55 +249,51 @@ class SoledadSignalingTestCase(BaseSoledadTest):
# 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')
+ local_db_path='alternative_stage3.u1db',
+ userid=ADDRESS)
# reverse call order so we can verify in the order the signals were
# expected
soledad.client.secrets.events.emit_async.mock_calls.reverse()
soledad.client.secrets.events.emit_async.call_args = \
soledad.client.secrets.events.emit_async.call_args_list[0]
soledad.client.secrets.events.emit_async.call_args_list.reverse()
+
+ user_data = {'userid': ADDRESS, 'uuid': ADDRESS}
+
# downloading keys signals
soledad.client.secrets.events.emit_async.assert_called_with(
- catalog.SOLEDAD_DOWNLOADING_KEYS,
- ADDRESS,
+ catalog.SOLEDAD_DOWNLOADING_KEYS, user_data
)
self._pop_mock_call(soledad.client.secrets.events.emit_async)
soledad.client.secrets.events.emit_async.assert_called_with(
- catalog.SOLEDAD_DONE_DOWNLOADING_KEYS,
- ADDRESS,
+ catalog.SOLEDAD_DONE_DOWNLOADING_KEYS, user_data
)
# creating keys signals
self._pop_mock_call(soledad.client.secrets.events.emit_async)
soledad.client.secrets.events.emit_async.assert_called_with(
- catalog.SOLEDAD_CREATING_KEYS,
- ADDRESS,
+ catalog.SOLEDAD_CREATING_KEYS, user_data
)
self._pop_mock_call(soledad.client.secrets.events.emit_async)
soledad.client.secrets.events.emit_async.assert_called_with(
- catalog.SOLEDAD_DONE_CREATING_KEYS,
- ADDRESS,
+ catalog.SOLEDAD_DONE_CREATING_KEYS, user_data
)
# downloading once more (inside _put_keys_in_shared_db)
self._pop_mock_call(soledad.client.secrets.events.emit_async)
soledad.client.secrets.events.emit_async.assert_called_with(
- catalog.SOLEDAD_DOWNLOADING_KEYS,
- ADDRESS,
+ catalog.SOLEDAD_DOWNLOADING_KEYS, user_data
)
self._pop_mock_call(soledad.client.secrets.events.emit_async)
soledad.client.secrets.events.emit_async.assert_called_with(
- catalog.SOLEDAD_DONE_DOWNLOADING_KEYS,
- ADDRESS,
+ catalog.SOLEDAD_DONE_DOWNLOADING_KEYS, user_data
)
# uploading keys signals
self._pop_mock_call(soledad.client.secrets.events.emit_async)
soledad.client.secrets.events.emit_async.assert_called_with(
- catalog.SOLEDAD_UPLOADING_KEYS,
- ADDRESS,
+ catalog.SOLEDAD_UPLOADING_KEYS, user_data
)
self._pop_mock_call(soledad.client.secrets.events.emit_async)
soledad.client.secrets.events.emit_async.assert_called_with(
- catalog.SOLEDAD_DONE_UPLOADING_KEYS,
- ADDRESS,
+ catalog.SOLEDAD_DONE_UPLOADING_KEYS, user_data
)
# assert db was locked and unlocked
sol.shared_db.lock.assert_called_with()
@@ -332,12 +328,12 @@ class SoledadSignalingTestCase(BaseSoledadTest):
# assert download keys signals
soledad.client.secrets.events.emit_async.assert_called_with(
catalog.SOLEDAD_DOWNLOADING_KEYS,
- ADDRESS,
+ {'userid': ADDRESS, 'uuid': ADDRESS}
)
self._pop_mock_call(soledad.client.secrets.events.emit_async)
soledad.client.secrets.events.emit_async.assert_called_with(
catalog.SOLEDAD_DONE_DOWNLOADING_KEYS,
- ADDRESS,
+ {'userid': ADDRESS, 'uuid': ADDRESS},
)
sol.close()
@@ -371,6 +367,6 @@ class SoledadSignalingTestCase(BaseSoledadTest):
# assert the signal has been emitted
soledad.client.events.emit_async.assert_called_with(
catalog.SOLEDAD_DONE_DATA_SYNC,
- ADDRESS,
+ {'userid': ADDRESS, 'uuid': ADDRESS},
)
sol.close()
diff --git a/common/src/leap/soledad/common/tests/util.py b/common/src/leap/soledad/common/tests/util.py
index f7f9ebd0..d4510686 100644
--- a/common/src/leap/soledad/common/tests/util.py
+++ b/common/src/leap/soledad/common/tests/util.py
@@ -245,6 +245,7 @@ class BaseSoledadTest(BaseLeapTest, MockedSharedDBTest):
# each local db.
self.rand_prefix = ''.join(
map(lambda x: random.choice(string.ascii_letters), range(6)))
+
# initialize soledad by hand so we can control keys
# XXX check if this soledad is actually used
self._soledad = self._soledad_instance(
@@ -285,7 +286,8 @@ class BaseSoledadTest(BaseLeapTest, MockedSharedDBTest):
server_url='https://127.0.0.1/',
cert_file=None,
shared_db_class=None,
- auth_token='auth-token'):
+ auth_token='auth-token',
+ userid=ADDRESS):
def _put_doc_side_effect(doc):
self._doc_put = doc
@@ -307,7 +309,8 @@ class BaseSoledadTest(BaseLeapTest, MockedSharedDBTest):
cert_file=cert_file,
defer_encryption=self.defer_sync_encryption,
shared_db=MockSharedDB(),
- auth_token=auth_token)
+ auth_token=auth_token,
+ userid=userid)
self.addCleanup(soledad.close)
return soledad