summaryrefslogtreecommitdiff
path: root/src/leap/keymanager/tests/__init__.py
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2014-12-13 10:15:53 -0600
committerRuben Pollan <meskio@sindominio.net>2014-12-16 11:55:16 -0600
commit7bafe2465cf6b4432a80d4cbe2c938716b911fb2 (patch)
tree3b97775f0ebd23ee5897fead392208831c0efd61 /src/leap/keymanager/tests/__init__.py
parent18d8fc8ab26885e24eaa05cc7843937b2381e4a8 (diff)
Find the gpg path instead of hard code it
Diffstat (limited to 'src/leap/keymanager/tests/__init__.py')
-rw-r--r--src/leap/keymanager/tests/__init__.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/leap/keymanager/tests/__init__.py b/src/leap/keymanager/tests/__init__.py
index 05b4487..7128d20 100644
--- a/src/leap/keymanager/tests/__init__.py
+++ b/src/leap/keymanager/tests/__init__.py
@@ -18,6 +18,9 @@
Base classes for the Key Manager tests.
"""
+import distutils.spawn
+import os.path
+
from twisted.internet.defer import gatherResults
from twisted.trial import unittest
@@ -29,14 +32,13 @@ from leap.keymanager.openpgp import OpenPGPKey
ADDRESS = 'leap@leap.se'
ADDRESS_2 = 'anotheruser@leap.se'
-# XXX discover the gpg binary path
-GPG_BINARY_PATH = '/usr/bin/gpg'
class KeyManagerWithSoledadTestCase(unittest.TestCase, BaseLeapTest):
def setUp(self):
self.setUpEnv()
+ self.gpg_binary_path = self._find_gpg()
self._soledad = Soledad(
u"leap@leap.se",
@@ -75,7 +77,14 @@ class KeyManagerWithSoledadTestCase(unittest.TestCase, BaseLeapTest):
def _key_manager(self, user=ADDRESS, url='', token=None):
return KeyManager(user, url, self._soledad, token=token,
- gpgbinary=GPG_BINARY_PATH)
+ gpgbinary=self.gpg_binary_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"
# key 24D18DDF: public key "Leap Test Key <leap@leap.se>"