summaryrefslogtreecommitdiff
path: root/common/src/leap/soledad
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/leap/soledad')
-rw-r--r--common/src/leap/soledad/common/tests/test_soledad.py40
1 files changed, 14 insertions, 26 deletions
diff --git a/common/src/leap/soledad/common/tests/test_soledad.py b/common/src/leap/soledad/common/tests/test_soledad.py
index b48915eb..aa52a733 100644
--- a/common/src/leap/soledad/common/tests/test_soledad.py
+++ b/common/src/leap/soledad/common/tests/test_soledad.py
@@ -100,6 +100,7 @@ class AuxMethodsTestCase(BaseSoledadTest):
self.assertEqual('value_1', sol._server_url)
sol.close()
+ @defer.inlineCallbacks
def test_change_passphrase(self):
"""
Test if passphrase can be changed.
@@ -111,38 +112,25 @@ class AuxMethodsTestCase(BaseSoledadTest):
prefix=prefix,
)
- def _change_passphrase(doc1):
- self._doc1 = doc1
- sol.change_passphrase(u'654321')
- sol.close()
-
- def _assert_wrong_password_raises(results):
- with self.assertRaises(DatabaseAccessError):
- self._soledad_instance(
- 'leap@leap.se',
- passphrase=u'123',
- prefix=prefix)
+ doc1 = yield sol.create_doc({'simple': 'doc'})
+ sol.change_passphrase(u'654321')
+ sol.close()
- def _instantiate_with_new_passphrase(results):
- sol2 = self._soledad_instance(
+ with self.assertRaises(DatabaseAccessError):
+ self._soledad_instance(
'leap@leap.se',
- passphrase=u'654321',
+ passphrase=u'123',
prefix=prefix)
- self._sol2 = sol2
- return sol2.get_doc(self._doc1.doc_id)
- def _assert_docs_are_equal(doc2):
- self.assertEqual(self._doc1, doc2)
- self._sol2.close()
+ sol2 = self._soledad_instance(
+ 'leap@leap.se',
+ passphrase=u'654321',
+ prefix=prefix)
+ doc2 = yield sol2.get_doc(doc1.doc_id)
- d = sol.create_doc({'simple': 'doc'})
- d.addCallback(_change_passphrase)
- d.addCallback(_assert_wrong_password_raises)
- d.addCallback(_instantiate_with_new_passphrase)
- d.addCallback(_assert_docs_are_equal)
- d.addCallback(lambda _: sol.close())
+ self.assertEqual(doc1, doc2)
- return d
+ sol2.close()
def test_change_passphrase_with_short_passphrase_raises(self):
"""