summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Mihai <92.alexandru.mihai@gmail.com>2015-06-22 23:47:47 +0300
committerAlexandru Mihai <92.alexandru.mihai@gmail.com>2015-06-22 23:47:47 +0300
commit85c13a786fb9fd48e8d5da4dc700e4cc2ece6136 (patch)
tree3cb1046a296d62686f2e6286a5560c9dc0a0fe47
parent3df27db421fbd8c54741a54772853378895b773d (diff)
downloadpyjwt-85c13a786fb9fd48e8d5da4dc700e4cc2ece6136.tar.gz
Added test for verify signature with empty algo
-rw-r--r--tests/test_api_jws.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_api_jws.py b/tests/test_api_jws.py
index 9395ae8..797e510 100644
--- a/tests/test_api_jws.py
+++ b/tests/test_api_jws.py
@@ -270,6 +270,16 @@ class TestJWS:
assert 'Signature verification' in str(exc.value)
+ def test_verify_signature_with_algo_none_throws_exception(self, jws, payload):
+ example_jws = (
+ b'e30'
+ b'.eyJhIjo1fQ'
+ b'.KEh186CjVw_Q8FadjJcaVnE7hO5Z9nHBbU8TgbhHcBY'
+ )
+
+ with pytest.raises(InvalidAlgorithmError) as exc:
+ jws.decode(example_jws, 'secret')
+
def test_invalid_crypto_alg(self, jws, payload):
with pytest.raises(NotImplementedError):
jws.encode(payload, 'secret', algorithm='HS1024')