diff options
author | drebs <drebs@leap.se> | 2013-04-16 18:22:06 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-04-16 18:22:06 -0300 |
commit | 5058072dd6a37b69aaaffe57c0fbfa5549426d6d (patch) | |
tree | 0314a89e8ec4eb85b5dc4c9d443341334eb81282 /src/leap/soledad/tests | |
parent | ef6ddc1f03b726b2a6b2a773e752c530d1371a80 (diff) |
Remove GPG asymmetric key stuff.
Everything related to asymmetric encryting will be handled by Key Manager.
Diffstat (limited to 'src/leap/soledad/tests')
-rw-r--r-- | src/leap/soledad/tests/__init__.py | 3 | ||||
-rw-r--r-- | src/leap/soledad/tests/test_couch.py | 3 | ||||
-rw-r--r-- | src/leap/soledad/tests/test_crypto.py | 46 | ||||
-rw-r--r-- | src/leap/soledad/tests/test_soledad.py | 8 |
4 files changed, 8 insertions, 52 deletions
diff --git a/src/leap/soledad/tests/__init__.py b/src/leap/soledad/tests/__init__.py index 1dbbe8ab..7f1e9f28 100644 --- a/src/leap/soledad/tests/__init__.py +++ b/src/leap/soledad/tests/__init__.py @@ -35,8 +35,6 @@ class BaseSoledadTest(BaseLeapTest): self._soledad._init_dirs() self._soledad._gpg = GPGWrapper(gnupghome=self.gnupg_home) #self._soledad._gpg.import_keys(PUBLIC_KEY) - if not self._soledad._has_privkey(): - self._soledad._set_privkey(PRIVATE_KEY) if not self._soledad._has_symkey(): self._soledad._gen_symkey() self._soledad._load_symkey() @@ -53,6 +51,7 @@ class BaseSoledadTest(BaseLeapTest): local_db_path='/soledad.u1db'): return Soledad( user, + '123', gnupg_home=self.tempdir+prefix+gnupg_home, secret_path=self.tempdir+prefix+secret_path, local_db_path=self.tempdir+prefix+local_db_path, diff --git a/src/leap/soledad/tests/test_couch.py b/src/leap/soledad/tests/test_couch.py index d9cdf788..a6171dd8 100644 --- a/src/leap/soledad/tests/test_couch.py +++ b/src/leap/soledad/tests/test_couch.py @@ -59,7 +59,8 @@ class CouchDBWrapper(object): # create the dirs from the template os.mkdir(os.path.join(self.tempdir, 'lib')) os.mkdir(os.path.join(self.tempdir, 'log')) - args = ['couchdb', '-n' '-a', confPath] + args = ['couchdb', '-n', '-a', confPath] + print args #null = open('/dev/null', 'w') self.process = subprocess.Popen( args, env=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, diff --git a/src/leap/soledad/tests/test_crypto.py b/src/leap/soledad/tests/test_crypto.py index 919ec88c..ee3b6c89 100644 --- a/src/leap/soledad/tests/test_crypto.py +++ b/src/leap/soledad/tests/test_crypto.py @@ -78,9 +78,6 @@ class RecoveryDocumentTestCase(BaseSoledadTest): self.assertEqual( { 'user': self._soledad._user, - 'privkey': self._soledad._gpg.export_keys( - self._soledad._fingerprint, - secret=True), 'symkey': self._soledad._symkey }, json.loads(rd), @@ -93,9 +90,6 @@ class RecoveryDocumentTestCase(BaseSoledadTest): self._soledad._gpg.is_encrypted_sym(rd)) data = { 'user': self._soledad._user, - 'privkey': self._soledad._gpg.export_keys( - self._soledad._fingerprint, - secret=True), 'symkey': self._soledad._symkey, } raw_data = json.loads(str(self._soledad._gpg.decrypt( @@ -124,23 +118,11 @@ class RecoveryDocumentTestCase(BaseSoledadTest): self.assertEqual(self._soledad._symkey, s._symkey, 'Failed settinng secret for symmetric encryption.') - self.assertEqual(self._soledad._fingerprint, - s._fingerprint, - 'Failed settinng fingerprint.') - pk1 = self._soledad._gpg.export_keys( - self._soledad._fingerprint, - secret=True) - pk2 = s._gpg.export_keys(s._fingerprint, secret=True) - self.assertEqual( - pk1, - pk2, - 'Failed settinng private key.' - ) def test_import_recovery_document_crypt(self): rd = self._soledad.export_recovery_document('123456') gnupg_home = self.gnupg_home = "%s/gnupg2" % self.tempdir - s = self._soledad_instance(user='anotheruser@leap.se') + s = self._soledad_instance(user='anotheruser@leap.se', prefix='3') s._init_dirs() s._gpg = GPGWrapper(gnupghome=gnupg_home) s.import_recovery_document(rd, '123456') @@ -149,37 +131,14 @@ class RecoveryDocumentTestCase(BaseSoledadTest): self.assertEqual(self._soledad._symkey, s._symkey, 'Failed settinng secret for symmetric encryption.') - self.assertEqual(self._soledad._fingerprint, - s._fingerprint, - 'Failed settinng fingerprint.') - pk1 = self._soledad._gpg.export_keys( - self._soledad._fingerprint, - secret=True) - pk2 = s._gpg.export_keys(s._fingerprint, secret=True) - self.assertEqual( - pk1, - pk2, - 'Failed settinng private key.' - ) class CryptoMethodsTestCase(BaseSoledadTest): - def test__gen_privkey(self): - sol = self._soledad_instance(user='user@leap.se', prefix='/4') - sol._init_dirs() - sol._gpg = GPGWrapper(gnupghome="%s/gnupg2" % self.tempdir) - self.assertFalse(sol._has_privkey(), 'Should not have a private key ' - 'at this point.') - sol._gen_privkey() - self.assertTrue(sol._has_privkey(), 'Could not generate privkey.') - def test__gen_symkey(self): sol = self._soledad_instance(user='user@leap.se', prefix='/3') sol._init_dirs() sol._gpg = GPGWrapper(gnupghome="%s/gnupg3" % self.tempdir) - if not sol._has_privkey(): - sol._set_privkey(PRIVATE_KEY) self.assertFalse(sol._has_symkey(), "Should not have a symkey at " "this point") sol._gen_symkey() @@ -190,8 +149,5 @@ class CryptoMethodsTestCase(BaseSoledadTest): sol._init_dirs() sol._gpg = GPGWrapper(gnupghome=self.tempdir+"/5/gnupg") self.assertFalse(sol._has_keys()) - sol._set_privkey(PRIVATE_KEY) - sol._has_privkey() - self.assertFalse(sol._has_keys()) sol._gen_symkey() self.assertTrue(sol._has_keys()) diff --git a/src/leap/soledad/tests/test_soledad.py b/src/leap/soledad/tests/test_soledad.py index 92d5182b..61d131f1 100644 --- a/src/leap/soledad/tests/test_soledad.py +++ b/src/leap/soledad/tests/test_soledad.py @@ -51,8 +51,6 @@ class AuxMethodsTestCase(BaseSoledadTest): sol._init_dirs() sol._gpg = self._gpgwrapper_instance() #self._soledad._gpg.import_keys(PUBLIC_KEY) - if not sol._has_privkey(): - sol._set_privkey(PRIVATE_KEY) if not sol._has_symkey(): sol._gen_symkey() sol._load_symkey() @@ -64,7 +62,7 @@ class AuxMethodsTestCase(BaseSoledadTest): """ Test if configuration defaults point to the correct place. """ - sol = Soledad(user='leap@leap.se', bootstrap=False) + sol = Soledad(user='leap@leap.se', passphrase='123', bootstrap=False) self.assertTrue(bool(re.match( '.*/\.config/leap/soledad/gnupg', sol._config.get_gnupg_home()))) self.assertTrue(bool(re.match( @@ -84,7 +82,7 @@ class AuxMethodsTestCase(BaseSoledadTest): # we use regexp match here because HOME environment variable is # changed by the BaseLeapTest class but BaseConfig does not capture # that change. - sol = Soledad(user='leap@leap.se', bootstrap=False) + sol = Soledad(user='leap@leap.se', passphrase='123', bootstrap=False) self.assertTrue(bool(re.match( '.*/\.config/leap/soledad/gnupg', sol._config.get_gnupg_home()))) self.assertTrue(bool(re.match( @@ -116,6 +114,7 @@ class AuxMethodsTestCase(BaseSoledadTest): f.close() sol = Soledad( user='leap@leap.se', + passphrase='123', bootstrap=False, config_path=tmpfile) self.assertEqual('value_1', sol._config.get_gnupg_home()) @@ -132,6 +131,7 @@ class AuxMethodsTestCase(BaseSoledadTest): # that change. sol = Soledad( user='leap@leap.se', + passphrase='123', bootstrap=False, gnupg_home='value_4', secret_path='value_3', |