diff options
author | drebs <drebs@leap.se> | 2013-04-29 17:36:22 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-04-29 17:36:37 -0300 |
commit | 027cd6cd2980c1dd5943392fbb4f3eefb7ccfaed (patch) | |
tree | d9be01cce7df7ab8b8ea7a75ef6ce0ab3eee01fa /src/leap/soledad/tests/test_crypto.py | |
parent | a67c6796a56f4adbf8be225c23c9b3faaac95261 (diff) |
Switch string literals to string constants.
Diffstat (limited to 'src/leap/soledad/tests/test_crypto.py')
-rw-r--r-- | src/leap/soledad/tests/test_crypto.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/leap/soledad/tests/test_crypto.py b/src/leap/soledad/tests/test_crypto.py index 5d494818..101b5d83 100644 --- a/src/leap/soledad/tests/test_crypto.py +++ b/src/leap/soledad/tests/test_crypto.py @@ -35,6 +35,9 @@ from leap.soledad.backends.leap_backend import ( decrypt_doc_json, EncryptionSchemes, LeapSyncTarget, + ENC_JSON_KEY, + ENC_SCHEME_KEY, + MAC_KEY, ) from leap.soledad.backends.couch import CouchDatabase from leap.soledad import KeyAlreadyExists, Soledad @@ -79,7 +82,7 @@ class EncryptedSyncTestCase(BaseSoledadTest): enc_json = json.loads( encrypt_doc_json( self._soledad._crypto, - doc1.doc_id, doc1.get_json()))['_encrypted_json'] + doc1.doc_id, doc1.get_json()))[ENC_JSON_KEY] self.assertEqual( True, self._soledad._crypto.is_encrypted_sym(enc_json), @@ -182,8 +185,8 @@ class RecoveryDocumentTestCase(BaseSoledadTest): rd = self._soledad.export_recovery_document(None) self.assertEqual( { - 'address': self._soledad._address, - 'symkey': self._soledad._symkey + self._soledad.ADDRESS_KEY: self._soledad._address, + self._soledad.SYMKEY_KEY: self._soledad._symkey }, json.loads(rd), "Could not export raw recovery document." @@ -194,12 +197,12 @@ class RecoveryDocumentTestCase(BaseSoledadTest): self.assertEqual(True, self._soledad._crypto.is_encrypted_sym(rd)) data = { - 'address': self._soledad._address, - 'symkey': self._soledad._symkey, + self._soledad.ADDRESS_KEY: self._soledad._address, + self._soledad.SYMKEY_KEY: self._soledad._symkey, } - raw_data = json.loads(str(self._soledad._crypto.decrypt_sym( + raw_data = json.loads(self._soledad._crypto.decrypt_sym( rd, - passphrase='123456'))) + passphrase='123456')) self.assertEqual( raw_data, data, |