summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/leap/keymanager/__init__.py7
-rw-r--r--src/leap/keymanager/tests/test_keymanager.py5
2 files changed, 8 insertions, 4 deletions
diff --git a/src/leap/keymanager/__init__.py b/src/leap/keymanager/__init__.py
index f00e049..01f3b6e 100644
--- a/src/leap/keymanager/__init__.py
+++ b/src/leap/keymanager/__init__.py
@@ -22,7 +22,9 @@ import fileinput
import os
import sys
import tempfile
+
from leap.common import ca_bundle
+
from ._version import get_versions
try:
@@ -146,7 +148,8 @@ class KeyManager(object):
def __del__(self):
try:
- created_tmp_combined_ca_bundle = self._combined_ca_bundle not in [ca_bundle.where(), self._ca_cert_path]
+ created_tmp_combined_ca_bundle = self._combined_ca_bundle not in \
+ [ca_bundle.where(), self._ca_cert_path]
if created_tmp_combined_ca_bundle:
os.remove(self._combined_ca_bundle)
except OSError:
@@ -164,7 +167,7 @@ class KeyManager(object):
elif not self._ca_cert_path:
return leap_ca_bundle
- tmp_file = tempfile.NamedTemporaryFile(delete=False) # delete when keymanager expires
+ tmp_file = tempfile.NamedTemporaryFile(delete=False)
with open(tmp_file.name, 'w') as fout:
fin = fileinput.input(files=(leap_ca_bundle, self._ca_cert_path))
diff --git a/src/leap/keymanager/tests/test_keymanager.py b/src/leap/keymanager/tests/test_keymanager.py
index b2722b2..8d4c5da 100644
--- a/src/leap/keymanager/tests/test_keymanager.py
+++ b/src/leap/keymanager/tests/test_keymanager.py
@@ -357,7 +357,7 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase):
verify=ca_bundle.where())
@inlineCallbacks
- def test_fetch_key_uses_default_ca_bundle_if_also_set_as_ca_cert_path(self):
+ def test_fetch_key_use_default_ca_bundle_if_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)
@@ -369,7 +369,8 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase):
@inlineCallbacks
def test_fetch_uses_combined_ca_bundle_otherwise(self):
- with tempfile.NamedTemporaryFile() as tmp_input, tempfile.NamedTemporaryFile(delete=False) as tmp_output:
+ with tempfile.NamedTemporaryFile() as tmp_input, \
+ tempfile.NamedTemporaryFile(delete=False) as tmp_output:
ca_content = 'some\ncontent\n'
ca_cert_path = tmp_input.name
self._dump_to_file(ca_cert_path, ca_content)