aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDanny Hermes <daniel.j.hermes@gmail.com>2016-02-19 16:37:29 -0800
committerDanny Hermes <daniel.j.hermes@gmail.com>2016-02-19 16:37:29 -0800
commitb605997beaa6361ab0811ffe62dfaf8de0eed03e (patch)
treea2ca012beb2dba8e681e9797d92b82036d7e3309 /tests
parent85df3253bfcfc8090754d225027f32bc15c640b6 (diff)
downloadoauth2client-b605997beaa6361ab0811ffe62dfaf8de0eed03e.tar.gz
Helpful error message in P12 factory in absence of pyOpenSSL.
Fixes #417.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_service_account.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_service_account.py b/tests/test_service_account.py
index 27423ea..3d9e7db 100644
--- a/tests/test_service_account.py
+++ b/tests/test_service_account.py
@@ -165,6 +165,21 @@ class ServiceAccountCredentialsTests(unittest2.TestCase):
self.assertEqual(creds._private_key_password, private_key_password)
self.assertEqual(creds._scopes, ' '.join(scopes))
+ def _p12_not_implemented_helper(self):
+ service_account_email = 'name@email.com'
+ filename = data_filename('privatekey.p12')
+ with self.assertRaises(NotImplementedError):
+ ServiceAccountCredentials.from_p12_keyfile(
+ service_account_email, filename)
+
+ @mock.patch('oauth2client.crypt.Signer', new=crypt.PyCryptoSigner)
+ def test_from_p12_keyfile_with_pycrypto(self):
+ self._p12_not_implemented_helper()
+
+ @mock.patch('oauth2client.crypt.Signer', new=crypt.RsaSigner)
+ def test_from_p12_keyfile_with_rsa(self):
+ self._p12_not_implemented_helper()
+
def test_from_p12_keyfile_defaults(self):
self._from_p12_keyfile_helper()