summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLandon GB <landogbland@gmail.com>2016-11-28 11:00:32 -0700
committerLandon GB <landogbland@gmail.com>2016-11-28 11:00:32 -0700
commit8520c8f0e0c9ea13df785e8143ee193f088c008a (patch)
tree7f9c721232c08bbfa625520ab494a5d9d6c20192
parent31494c95cb9c1342d3b1e02feac41a83667dc4cd (diff)
downloadpyjwt-8520c8f0e0c9ea13df785e8143ee193f088c008a.tar.gz
Unit test for better errors when missing cryptography package
-rw-r--r--tests/test_api_jws.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_api_jws.py b/tests/test_api_jws.py
index 403735d..d0876a4 100644
--- a/tests/test_api_jws.py
+++ b/tests/test_api_jws.py
@@ -303,6 +303,12 @@ class TestJWS:
with pytest.raises(NotImplementedError):
jws.encode(payload, 'secret', algorithm='HS1024')
+ @pytest.mark.skipif(has_crypto, reason='Tests better errors if crypography not installed')
+ def test_missing_crypto_library_better_error_messages(self, jws, payload):
+ with pytest.raises(NotImplementedError) as excinfo:
+ jws.encode(payload, 'secret', algorithm='RS256')
+ assert 'cryptography' in str(excinfo.value)
+
def test_unicode_secret(self, jws, payload):
secret = '\xc2'
jws_message = jws.encode(payload, secret)