diff options
author | José Padilla <jpadilla@users.noreply.github.com> | 2022-05-15 15:18:29 -0400 |
---|---|---|
committer | José Padilla <jpadilla@users.noreply.github.com> | 2022-05-15 15:18:29 -0400 |
commit | 23feb3b068deb5f077e37c98541e7151782e544f (patch) | |
tree | 0584ad94ceb2769bb1598d2977c89628214b5218 /tests | |
parent | 54405e5e07dd4fb0bf58b77afd485f221b68a3b4 (diff) | |
download | pyjwt-23feb3b068deb5f077e37c98541e7151782e544f.tar.gz |
chore: fix lint errors
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_advisory.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/test_advisory.py b/tests/test_advisory.py index a4a7d23..ed768d4 100644 --- a/tests/test_advisory.py +++ b/tests/test_advisory.py @@ -1,14 +1,17 @@ -import jwt import pytest + +import jwt from jwt.exceptions import InvalidKeyError from .utils import crypto_required -priv_key_bytes = b'''-----BEGIN PRIVATE KEY----- +priv_key_bytes = b"""-----BEGIN PRIVATE KEY----- MC4CAQAwBQYDK2VwBCIEIIbBhdo2ah7X32i50GOzrCr4acZTe6BezUdRIixjTAdL ------END PRIVATE KEY-----''' +-----END PRIVATE KEY-----""" -pub_key_bytes = b'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPL1I9oiq+B8crkmuV4YViiUnhdLjCp3hvy1bNGuGfNL' +pub_key_bytes = ( + b"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPL1I9oiq+B8crkmuV4YViiUnhdLjCp3hvy1bNGuGfNL" +) ssh_priv_key_bytes = b"""-----BEGIN EC PRIVATE KEY----- MHcCAQEEIOWc7RbaNswMtNtc+n6WZDlUblMr2FBPo79fcGXsJlGQoAoGCCqGSM49 @@ -41,11 +44,11 @@ class TestAdvisory: # Making a good jwt token that should work by signing it # with the private key # encoded_good = jwt.encode({"test": 1234}, priv_key_bytes, algorithm="EdDSA") - encoded_good = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJ0ZXN0IjoxMjM0fQ.M5y1EEavZkHSlj9i8yi9nXKKyPBSAUhDRTOYZi3zZY11tZItDaR3qwAye8pc74_lZY3Ogt9KPNFbVOSGnUBHDg' + encoded_good = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJ0ZXN0IjoxMjM0fQ.M5y1EEavZkHSlj9i8yi9nXKKyPBSAUhDRTOYZi3zZY11tZItDaR3qwAye8pc74_lZY3Ogt9KPNFbVOSGnUBHDg" # Using HMAC with the public key to trick the receiver to think that the # public key is a HMAC secret - encoded_bad = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0ZXN0IjoxMjM0fQ.6ulDpqSlbHmQ8bZXhZRLFko9SwcHrghCwh8d-exJEE4' + encoded_bad = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0ZXN0IjoxMjM0fQ.6ulDpqSlbHmQ8bZXhZRLFko9SwcHrghCwh8d-exJEE4" # Both of the jwt tokens are validated as valid jwt.decode( @@ -101,12 +104,12 @@ class TestAdvisory: jwt.decode( encoded_good, ssh_key_bytes, - algorithms=jwt.algorithms.get_default_algorithms() + algorithms=jwt.algorithms.get_default_algorithms(), ) with pytest.raises(InvalidKeyError): jwt.decode( encoded_bad, ssh_key_bytes, - algorithms=jwt.algorithms.get_default_algorithms() + algorithms=jwt.algorithms.get_default_algorithms(), ) |