Skip to content

Commit bbc2e13

Browse files
jdufresnesingingwolfboy
authored andcommitted
Correct dependency for 'rsa' extra (#355)
The RSA tests only pass if 'oauthlib[signedtoken]' is installed. 'oauthlib[rsa]' is not enough. This brings the dependency in line with the requirements.txt file. Skip the test if pyjwt is not installed to avoid a test failure due to an ImportError.
1 parent 7435f6f commit bbc2e13

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def readall(path):
4545
packages=['requests_oauthlib', 'requests_oauthlib.compliance_fixes'],
4646
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
4747
install_requires=['oauthlib>=2.1.0,<3.0.0', 'requests>=2.0.0'],
48-
extras_require={'rsa': ['oauthlib[rsa]>=2.1.0,<3.0.0']},
48+
extras_require={'rsa': ['oauthlib[signedtoken]>=2.1.0,<3.0.0']},
4949
license='ISC',
5050
classifiers=[
5151
'Development Status :: 5 - Production/Stable',

tests/test_oauth1_session.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
except ImportError:
1616
cryptography = None
1717

18+
try:
19+
import jwt
20+
except ImportError:
21+
jwt = None
22+
1823
if sys.version[0] == '3':
1924
unicode_type = str
2025
else:
@@ -92,6 +97,8 @@ def fake_send(r, **kwargs):
9297
def test_signature_methods(self, generate_nonce, generate_timestamp):
9398
if not cryptography:
9499
raise unittest.SkipTest('cryptography module is required')
100+
if not jwt:
101+
raise unittest.SkipTest('pyjwt module is required')
95102

96103
generate_nonce.return_value = 'abc'
97104
generate_timestamp.return_value = '123'
@@ -285,6 +292,8 @@ def test_authorized_true(self):
285292
def test_authorized_true_rsa(self, generate_nonce, generate_timestamp):
286293
if not cryptography:
287294
raise unittest.SkipTest('cryptography module is required')
295+
if not jwt:
296+
raise unittest.SkipTest('pyjwt module is required')
288297

289298
generate_nonce.return_value = 'abc'
290299
generate_timestamp.return_value = '123'

0 commit comments

Comments
 (0)