diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2016-09-06 16:33:22 -0400 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2016-09-06 16:33:47 -0400 |
commit | 728ffae25134b6d68be7567803ed8310a18a86a6 (patch) | |
tree | 5e8a3a578b30c5fb72245bd35bfdf6345ed2703d /tests/integration/keymanager/common.py | |
parent | a0c08653bfa1b9f5a3b86595dfcd015eac8f7fca (diff) |
[tests] factor out the common pieces to keymanager.testing
Diffstat (limited to 'tests/integration/keymanager/common.py')
-rw-r--r-- | tests/integration/keymanager/common.py | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/tests/integration/keymanager/common.py b/tests/integration/keymanager/common.py index e170d78c..3371ceb8 100644 --- a/tests/integration/keymanager/common.py +++ b/tests/integration/keymanager/common.py @@ -32,76 +32,6 @@ PATH = os.path.dirname(os.path.realpath(__file__)) ADDRESS = 'leap@leap.se' ADDRESS_2 = 'anotheruser@leap.se' - -class KeyManagerWithSoledadTestCase(unittest.TestCase, BaseLeapTest): - - def setUp(self): - self.gpg_binary_path = self._find_gpg() - - self._soledad = Soledad( - u"leap@leap.se", - u"123456", - secrets_path=self.tempdir + "/secret.gpg", - local_db_path=self.tempdir + "/soledad.u1db", - server_url='', - cert_file=None, - auth_token=None, - syncable=False - ) - - def tearDown(self): - km = self._key_manager() - - # wait for the indexes to be ready for the tear down - d = km._openpgp.deferred_init - d.addCallback(lambda _: self.delete_all_keys(km)) - d.addCallback(lambda _: self._soledad.close()) - return d - - def delete_all_keys(self, km): - def delete_keys(keys): - deferreds = [] - for key in keys: - d = km._openpgp.delete_key(key) - deferreds.append(d) - return gatherResults(deferreds) - - def check_deleted(_, private): - d = km.get_all_keys(private=private) - d.addCallback(lambda keys: self.assertEqual(keys, [])) - return d - - deferreds = [] - for private in [True, False]: - d = km.get_all_keys(private=private) - d.addCallback(delete_keys) - d.addCallback(check_deleted, private) - deferreds.append(d) - return gatherResults(deferreds) - - def _key_manager(self, user=ADDRESS, url='', token=None, - ca_cert_path=None): - return KeyManager(user, url, self._soledad, token=token, - gpgbinary=self.gpg_binary_path, - ca_cert_path=ca_cert_path) - - def _find_gpg(self): - gpg_path = distutils.spawn.find_executable('gpg') - if gpg_path is not None: - return os.path.realpath(gpg_path) - else: - return "/usr/bin/gpg" - - def get_public_binary_key(self): - with open(PATH + '/fixtures/public_key.bin', 'r') as binary_public_key: - return binary_public_key.read() - - def get_private_binary_key(self): - with open( - PATH + '/fixtures/private_key.bin', 'r') as binary_private_key: - return binary_private_key.read() - - # key 24D18DDF: public key "Leap Test Key <leap@leap.se>" KEY_FINGERPRINT = "E36E738D69173C13D709E44F2F455E2824D18DDF" PUBLIC_KEY = """ |