When the Crypto package dependency is met with PyCryptodome instead of PyCrypto, rauth.oauth.RsaSha1Signature raises AttributeError because the internal implementation details differ in Crypto.PublicKey.RSA.
======================================================================
======================================================================
ERROR: test_rsasha1_badargument (test_oauth.OAuthTestRsaSha1Case)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/neirbowj/src/github/rauth/tests/test_oauth.py", line 214, in test_rsasha1_badargument
self.req_kwargs)
File "/usr/local/lib/python2.7/unittest/case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "/home/neirbowj/src/github/rauth/rauth/oauth.py", line 211, in sign
if not isinstance(consumer_secret, self.RSA._RSAobj):
AttributeError: 'module' object has no attribute '_RSAobj'
======================================================================
ERROR: test_rsasha1_signature (test_oauth.OAuthTestRsaSha1Case)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/neirbowj/src/github/rauth/tests/test_oauth.py", line 199, in test_rsasha1_signature
self.req_kwargs)
File "/home/neirbowj/src/github/rauth/rauth/oauth.py", line 211, in sign
if not isinstance(consumer_secret, self.RSA._RSAobj):
AttributeError: 'module' object has no attribute '_RSAobj'
Based on source code analysis, it should also be fine to remove the isinstance check entirely, because both implementations either return a valid object or raise an exception.
When the
Crypto
package dependency is met with PyCryptodome instead of PyCrypto,rauth.oauth.RsaSha1Signature
raisesAttributeError
because the internal implementation details differ inCrypto.PublicKey.RSA
.