summaryrefslogtreecommitdiff
path: root/src/leap/soledad/tests
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-03-11 12:20:11 -0300
committerdrebs <drebs@leap.se>2013-03-11 12:20:11 -0300
commitaa48da25c13c1565c72bf5f0cb93b49fbc27c29a (patch)
treecbe38da43cb6e80171c267dc2bf1e7e1789778a4 /src/leap/soledad/tests
parenta3e4744390c29103918ad6180598f6a508e35041 (diff)
Add recovery document export.
Diffstat (limited to 'src/leap/soledad/tests')
-rw-r--r--src/leap/soledad/tests/test_encrypted.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/leap/soledad/tests/test_encrypted.py b/src/leap/soledad/tests/test_encrypted.py
index 4a48266e..0a4eb9cc 100644
--- a/src/leap/soledad/tests/test_encrypted.py
+++ b/src/leap/soledad/tests/test_encrypted.py
@@ -37,3 +37,35 @@ class EncryptedSyncTestCase(BaseSoledadTest):
True,
self._soledad._gpg.is_encrypted_sym(enc_json),
"could not encrypt with passphrase.")
+
+ def test_export_recovery_document_raw(self):
+ rd = self._soledad.export_recovery_document(None)
+ self.assertEqual(
+ [
+ self._soledad._user_email,
+ self._soledad._gpg.export_keys(self._soledad._fingerprint,
+ secret=True),
+ self._soledad._secret
+ ],
+ json.loads(rd),
+ "Could not export raw recovery document."
+ )
+
+ def test_export_recovery_document_crypt(self):
+ rd = self._soledad.export_recovery_document('123456')
+ self.assertEqual(True,
+ self._soledad._gpg.is_encrypted_sym(rd))
+ data = [
+ self._soledad._user_email,
+ self._soledad._gpg.export_keys(self._soledad._fingerprint,
+ secret=True),
+ self._soledad._secret,
+ ]
+ raw_data = json.loads(str(self._soledad._gpg.decrypt(
+ rd,
+ passphrase='123456')))
+ self.assertEqual(
+ raw_data,
+ data,
+ "Could not export raw recovery document."
+ )