Skip to content

Commit

Permalink
feat(test_api_jwt): ensure audience as bytes raises error
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianMaurin committed Jul 21, 2022
1 parent 73f312b commit 40d0950
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_api_jwt.py
Expand Up @@ -419,6 +419,12 @@ def test_raise_exception_invalid_audience(self, jwt):
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",
Expand Down

0 comments on commit 40d0950

Please sign in to comment.