Skip to content

Commit

Permalink
Fix test to use correct parameters
Browse files Browse the repository at this point in the history
Otherwise false negatives may happen

Signed-off-by: Simo Sorce <simo@redhat.com>
  • Loading branch information
simo5 committed Apr 26, 2022
1 parent c6dcae9 commit 38b427c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions jwcrypto/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,9 @@ def test_decrypt_keyset(self):
t.make_encrypted_token(key)
token = t.serialize()
# try to decrypt without a matching key
self.assertRaises(jwt.JWTMissingKey, jwt.JWT, jwt=token, key=keyset)
self.assertRaises(jwt.JWTMissingKey, jwt.JWT, jwt=token, key=keyset,
algs=jwe_algs_and_rsa1_5,
check_claims={'exp': 1300819380})
# now decrypt with key
keyset.add(key)
jwt.JWT(jwt=token, key=keyset, algs=jwe_algs_and_rsa1_5,
Expand All @@ -1509,7 +1511,9 @@ def test_decrypt_keyset(self):
t.make_encrypted_token(key)
token = t.serialize()
# try to decrypt without a matching key
self.assertRaises(jwt.JWTMissingKey, jwt.JWT, jwt=token, key=keyset)
self.assertRaises(jwt.JWTMissingKey, jwt.JWT, jwt=token, key=keyset,
algs=jwe_algs_and_rsa1_5,
check_claims={'exp': 1300819380})
# now decrypt with key
keyset.add(key)
jwt.JWT(jwt=token, key=keyset, algs=jwe_algs_and_rsa1_5,
Expand All @@ -1531,7 +1535,8 @@ def test_decrypt_keyset_dup_kid(self):

# try to decrypt without a matching key
with self.assertRaises(jwt.JWTMissingKey):
jwt.JWT(jwt=token, key=keyset, check_claims={'exp': 1300819380})
jwt.JWT(jwt=token, key=keyset, algs=jwe_algs_and_rsa1_5,
check_claims={'exp': 1300819380})

# add right key
keyset.add(key)
Expand Down

0 comments on commit 38b427c

Please sign in to comment.