This repository has been archived by the owner on Jan 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #424 from dhermes/fix-417
Helpful error message in P12 factory in absence of pyOpenSSL.
- Loading branch information
Showing
3 changed files
with
20 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,6 +165,21 @@ def _from_p12_keyfile_helper(self, private_key_password=None, scopes=''): | |
self.assertEqual(creds._private_key_password, private_key_password) | ||
self.assertEqual(creds._scopes, ' '.join(scopes)) | ||
|
||
def _p12_not_implemented_helper(self): | ||
service_account_email = '[email protected]' | ||
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() | ||
|
||
|