Skip to content

Commit 8520c8f

Browse files
committed
Unit test for better errors when missing cryptography package
1 parent 31494c9 commit 8520c8f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/test_api_jws.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,12 @@ def test_invalid_crypto_alg(self, jws, payload):
303303
with pytest.raises(NotImplementedError):
304304
jws.encode(payload, 'secret', algorithm='HS1024')
305305

306+
@pytest.mark.skipif(has_crypto, reason='Tests better errors if crypography not installed')
307+
def test_missing_crypto_library_better_error_messages(self, jws, payload):
308+
with pytest.raises(NotImplementedError) as excinfo:
309+
jws.encode(payload, 'secret', algorithm='RS256')
310+
assert 'cryptography' in str(excinfo.value)
311+
306312
def test_unicode_secret(self, jws, payload):
307313
secret = '\xc2'
308314
jws_message = jws.encode(payload, secret)

0 commit comments

Comments
 (0)