summaryrefslogtreecommitdiff
path: root/src/leap/soledad/tests
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2012-12-18 18:51:01 -0200
committerdrebs <drebs@leap.se>2012-12-18 18:51:01 -0200
commit7a67c36efd95d86dea04ab0741c68f5307a95c09 (patch)
treeb1ae9874bb4d622b8f2cc6cb52a7789f6ba8459b /src/leap/soledad/tests
parenta14d5ae150c52c3419764443409b7d146c43cb09 (diff)
Refactor and symmetric encryption
Diffstat (limited to 'src/leap/soledad/tests')
-rw-r--r--src/leap/soledad/tests/test_encrypted.py15
-rw-r--r--src/leap/soledad/tests/test_logs.py2
2 files changed, 8 insertions, 9 deletions
diff --git a/src/leap/soledad/tests/test_encrypted.py b/src/leap/soledad/tests/test_encrypted.py
index 2333fc41..eafd258e 100644
--- a/src/leap/soledad/tests/test_encrypted.py
+++ b/src/leap/soledad/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/src/leap/soledad/tests/test_logs.py b/src/leap/soledad/tests/test_logs.py
index a68e0262..d61700f2 100644
--- a/src/leap/soledad/tests/test_logs.py
+++ b/src/leap/soledad/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):