diff options
author | drebs <drebs@leap.se> | 2012-12-18 18:51:01 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2012-12-18 18:51:01 -0200 |
commit | 6306a61d8c6c840a09ea9aa26e439a40dc9b5a9a (patch) | |
tree | 5d63e737a7f3169f1fece8afef5d10a4a458dd0a /tests | |
parent | 2d4fc3ee887fd52ac06fdd6f99bdc4b445a79463 (diff) |
Refactor and symmetric encryption
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_encrypted.py | 15 | ||||
-rw-r--r-- | tests/test_logs.py | 2 |
2 files changed, 8 insertions, 9 deletions
diff --git a/tests/test_encrypted.py b/tests/test_encrypted.py index 2333fc41..eafd258e 100644 --- a/tests/test_encrypted.py +++ b/tests/test_encrypted.py @@ -7,7 +7,7 @@ import unittest2 as unittest import os import u1db -from soledad import GPGWrapper +from soledad import Soledad from soledad.backends.leap import LeapDocument @@ -17,28 +17,27 @@ class EncryptedSyncTestCase(unittest.TestCase): GNUPG_HOME = "%s/gnupg" % PREFIX DB1_FILE = "%s/db1.u1db" % PREFIX DB2_FILE = "%s/db2.u1db" % PREFIX + EMAIL = 'leap@leap.se' def setUp(self): self.db1 = u1db.open(self.DB1_FILE, create=True, document_factory=LeapDocument) self.db2 = u1db.open(self.DB2_FILE, create=True, document_factory=LeapDocument) - self.gpg = GPGWrapper(gpghome=self.GNUPG_HOME) - self.gpg.import_keys(PUBLIC_KEY) - self.gpg.import_keys(PRIVATE_KEY) + self.soledad = Soledad(self.EMAIL, gpghome=self.GNUPG_HOME) + self.soledad._gpg.import_keys(PUBLIC_KEY) + self.soledad._gpg.import_keys(PRIVATE_KEY) def tearDown(self): os.unlink(self.DB1_FILE) os.unlink(self.DB2_FILE) def test_get_set_encrypted(self): - doc1 = LeapDocument(gpg_wrapper = self.gpg, - default_key = KEY_FINGERPRINT) + doc1 = LeapDocument(soledad=self.soledad) doc1.content = { 'key' : 'val' } doc2 = LeapDocument(doc_id=doc1.doc_id, encrypted_json=doc1.get_encrypted_json(), - gpg_wrapper=self.gpg, - default_key = KEY_FINGERPRINT) + soledad=self.soledad) res1 = doc1.get_json() res2 = doc2.get_json() self.assertEqual(res1, res2, 'incorrect document encryption') diff --git a/tests/test_logs.py b/tests/test_logs.py index a68e0262..d61700f2 100644 --- a/tests/test_logs.py +++ b/tests/test_logs.py @@ -1,5 +1,5 @@ import unittest2 as unittest -from soledad import TransactionLog, SyncLog +from soledad.util import TransactionLog, SyncLog class LogTestCase(unittest.TestCase): |