aboutsummaryrefslogtreecommitdiff
path: root/tests/test_crypt.py
diff options
context:
space:
mode:
authorCraig Citro <craigcitro@google.com>2015-05-15 00:35:28 -0700
committerCraig Citro <craigcitro@google.com>2015-05-15 00:37:29 -0700
commita687e966c3788e54e00dea6904fccd46e138aa94 (patch)
treee06763b8654367dd74547678ce4b196a550adc4a /tests/test_crypt.py
parente7340f3c1c9987e42504cfa71646762189ba7df2 (diff)
downloadoauth2client-a687e966c3788e54e00dea6904fccd46e138aa94.tar.gz
Simplify OpenSSL checks in crypt.py.
Previously, when confirming OpenSSL is installed, we checked that the module was installed, and verified that `crypto.py` was contained in the package directory. However, this can cause issues in cases of non-standard installs. In addition, the `imp.find_module` call already raises an `ImportError` in the case that the module is missing, so this second check isn't needed. Instead, we just drop the explicit check for `crypto.py` in the `OpenSSL` directory.
Diffstat (limited to 'tests/test_crypt.py')
-rw-r--r--tests/test_crypt.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/test_crypt.py b/tests/test_crypt.py
index f471b5f..74c25b6 100644
--- a/tests/test_crypt.py
+++ b/tests/test_crypt.py
@@ -58,15 +58,17 @@ class Test_pkcs12_key_as_pem(unittest.TestCase):
self.assertTrue(pem_contents in [pkcs12_key_as_pem, alternate_pem])
def test_without_openssl(self):
- import os
- path_isfile = os.path.isfile
+ import imp
+ imp_find_module = imp.find_module
+ def find_module(module_name):
+ raise ImportError('No module named %s' % module_name)
try:
- os.path.isfile = lambda value: False
+ imp.find_module = find_module
reload(crypt)
self.assertRaises(NotImplementedError, crypt.pkcs12_key_as_pem,
'FOO', 'BAR')
finally:
- os.path.isfile = path_isfile
+ imp.find_module = imp_find_module
reload(crypt)
def test_with_nonsense_key(self):