Skip to content

Commit

Permalink
Updated test for the keycloak permission mapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
dusktreader committed Oct 14, 2024
1 parent 406e6a6 commit 59b58ab
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_token_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
These tests verify the functionality of the TokenDecoder.
"""

from uuid import uuid4
from unittest import mock

import pytest
Expand Down Expand Up @@ -141,19 +142,20 @@ def extractor(_):

def test_extract_keycloak_permissions():
"""
Verify the `extract_keyclaok_permissons()` works as intended.
Verify the `extract_keycloak_permissions()` works as intended.
It should correctly extract's the client's role as the permissions to be used in the
TokenPayload.
"""
client_id = uuid4()
decoded_token = {
"exp": 1728627701,
"iat": 1728626801,
"jti": "24fdb7ef-d773-4e6b-982a-b8126dd58af7",
"sub": "dfa64115-40b5-46ab-924c-c376e73f631d",
"azp": "my-client",
"azp": client_id,
"resource_access": {
"my-client": {"roles": ["read:stuff"]},
client_id: {"roles": ["read:stuff"]},
},
}

Expand Down

0 comments on commit 59b58ab

Please sign in to comment.