summaryrefslogtreecommitdiff
path: root/tests/test_api_jwt.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_api_jwt.py')
-rw-r--r--tests/test_api_jwt.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/test_api_jwt.py b/tests/test_api_jwt.py
index d0443e8..bebe7d2 100644
--- a/tests/test_api_jwt.py
+++ b/tests/test_api_jwt.py
@@ -119,7 +119,7 @@ class TestJWT:
jwt.decode(example_jwt, secret, audience=1, algorithms=["HS256"])
exception = context.value
- assert str(exception) == "audience must be a string, iterable, or None"
+ assert str(exception) == "audience must be a string, iterable or None"
def test_decode_with_nonlist_aud_claim_throws_exception(self, jwt):
secret = "secret"
@@ -419,6 +419,14 @@ class TestJWT:
with pytest.raises(InvalidAudienceError):
jwt.decode(token, "secret", audience="urn-me", algorithms=["HS256"])
+ def test_raise_exception_audience_as_bytes(self, jwt):
+ payload = {"some": "payload", "aud": ["urn:me", "urn:someone-else"]}
+ token = jwt.encode(payload, "secret")
+ with pytest.raises(InvalidAudienceError):
+ jwt.decode(
+ token, "secret", audience="urn:me".encode(), algorithms=["HS256"]
+ )
+
def test_raise_exception_invalid_audience_in_array(self, jwt):
payload = {
"some": "payload",