summaryrefslogtreecommitdiff
path: root/src/leap/keymanager
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-09-22 17:43:29 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-09-24 09:39:57 +0200
commit3da04e10ce961e2606ce00125d092d9daa621636 (patch)
tree9d9cd01f75c0b2734561ca74bfff43d1b157b18f /src/leap/keymanager
parent1b805754f1d6efe9af25dcf0ab60b3aa2100ee20 (diff)
[bug] treat empty string ca_cert_path as None
Fixup for 9546348c36. This problem only occurs in test setups where '' is passed to ca_cert_path.
Diffstat (limited to 'src/leap/keymanager')
-rw-r--r--src/leap/keymanager/__init__.py2
-rw-r--r--src/leap/keymanager/tests/test_keymanager.py13
2 files changed, 13 insertions, 2 deletions
diff --git a/src/leap/keymanager/__init__.py b/src/leap/keymanager/__init__.py
index e378c91f..cf099bb1 100644
--- a/src/leap/keymanager/__init__.py
+++ b/src/leap/keymanager/__init__.py
@@ -148,7 +148,7 @@ class KeyManager(object):
if self._ca_cert_path == leap_ca_bundle:
return self._ca_cert_path # don't merge file with itself
- elif self._ca_cert_path is None:
+ elif not self._ca_cert_path:
return leap_ca_bundle
# file is auto deleted when python process ends
diff --git a/src/leap/keymanager/tests/test_keymanager.py b/src/leap/keymanager/tests/test_keymanager.py
index 7c002926..3b4aa0f6 100644
--- a/src/leap/keymanager/tests/test_keymanager.py
+++ b/src/leap/keymanager/tests/test_keymanager.py
@@ -346,7 +346,18 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase):
verify=ca_bundle.where())
@inlineCallbacks
- def test_fetch_key_uses_default_ca_bundle_if_also_set_as_ca_cert(self):
+ def test_fetch_key_uses_ca_bundle_if_empty_string_specified(self):
+ ca_cert_path = ''
+ km = self._key_manager(ca_cert_path=ca_cert_path)
+ get_mock = self._mock_get_response(km, PUBLIC_KEY_OTHER)
+
+ yield km.fetch_key(ADDRESS_OTHER, REMOTE_KEY_URL, OpenPGPKey)
+
+ get_mock.assert_called_once_with(REMOTE_KEY_URL, data=None,
+ verify=ca_bundle.where())
+
+ @inlineCallbacks
+ def test_fetch_key_uses_default_ca_bundle_if_also_set_as_ca_cert_path(self):
ca_cert_path = ca_bundle.where()
km = self._key_manager(ca_cert_path=ca_cert_path)
get_mock = self._mock_get_response(km, PUBLIC_KEY_OTHER)