diff options
author | Kali Kaneko <kali@leap.se> | 2015-02-11 14:03:29 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-02-11 14:03:29 -0400 |
commit | 58256957af8329f49d983852063eeaec74179c4d (patch) | |
tree | 4d95bf772a8845669bf9b5c7b6dc26f58bfdaa59 /common/src/leap/soledad/common/tests/test_crypto.py | |
parent | fa8dacef003d30cd9b56f7e2b07baa3b387c1e20 (diff) | |
parent | 14f34b1f64a667bf4a146e8579f95c5d308a1f77 (diff) |
Merge branch 'feature/async-api' into develop
Diffstat (limited to 'common/src/leap/soledad/common/tests/test_crypto.py')
-rw-r--r-- | common/src/leap/soledad/common/tests/test_crypto.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/common/src/leap/soledad/common/tests/test_crypto.py b/common/src/leap/soledad/common/tests/test_crypto.py index f5fb4b7a..fdad8aac 100644 --- a/common/src/leap/soledad/common/tests/test_crypto.py +++ b/common/src/leap/soledad/common/tests/test_crypto.py @@ -23,7 +23,7 @@ import binascii from leap.soledad.client import crypto from leap.soledad.common.document import SoledadDocument -from leap.soledad.common.tests import BaseSoledadTest +from leap.soledad.common.tests.util import BaseSoledadTest from leap.soledad.common.crypto import WrongMacError from leap.soledad.common.crypto import UnknownMacMethodError from leap.soledad.common.crypto import EncryptionMethods @@ -82,7 +82,7 @@ class RecoveryDocumentTestCase(BaseSoledadTest): rd = self._soledad.secrets._export_recovery_document() s = self._soledad_instance() s.secrets._import_recovery_document(rd) - s.set_secret_id(self._soledad.secrets._secret_id) + s.secrets.set_secret_id(self._soledad.secrets._secret_id) self.assertEqual(self._soledad.storage_secret, s.storage_secret, 'Failed settinng secret for symmetric encryption.') @@ -95,7 +95,7 @@ class SoledadSecretsTestCase(BaseSoledadTest): # instantiate and save secret_id sol = self._soledad_instance(user='user@leap.se') self.assertTrue(len(sol.secrets._secrets) == 1) - secret_id_1 = sol.secret_id + secret_id_1 = sol.secrets.secret_id # assert id is hash of secret self.assertTrue( secret_id_1 == hashlib.sha256(sol.storage_secret).hexdigest()) @@ -104,9 +104,8 @@ class SoledadSecretsTestCase(BaseSoledadTest): self.assertTrue(secret_id_1 != secret_id_2) sol.close() # re-instantiate - sol = self._soledad_instance( - user='user@leap.se', - secret_id=secret_id_1) + sol = self._soledad_instance(user='user@leap.se') + sol.secrets.set_secret_id(secret_id_1) # assert ids are valid self.assertTrue(len(sol.secrets._secrets) == 2) self.assertTrue(secret_id_1 in sol.secrets._secrets) @@ -117,7 +116,7 @@ class SoledadSecretsTestCase(BaseSoledadTest): secret_length = sol.secrets.GEN_SECRET_LENGTH self.assertTrue(len(sol.storage_secret) == secret_length) # assert format of secret 2 - sol.set_secret_id(secret_id_2) + sol.secrets.set_secret_id(secret_id_2) self.assertTrue(sol.storage_secret is not None) self.assertIsInstance(sol.storage_secret, str) self.assertTrue(len(sol.storage_secret) == secret_length) @@ -134,12 +133,12 @@ class SoledadSecretsTestCase(BaseSoledadTest): "Should have a secret at this point") # setting secret id to None should not interfere in the fact we have a # secret. - sol.set_secret_id(None) + sol.secrets.set_secret_id(None) self.assertTrue( sol.secrets._has_secret(), "Should have a secret at this point") # but not being able to decrypt correctly should - sol.secrets._secrets[sol.secret_id] = None + sol.secrets._secrets[sol.secrets.secret_id] = None self.assertFalse(sol.secrets._has_secret()) sol.close() |