Skip to content

Commit

Permalink
Test loading JWK directly
Browse files Browse the repository at this point in the history
  • Loading branch information
blag committed Sep 8, 2020
1 parent 89c3d41 commit 60fa95d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_jws.py
Expand Up @@ -89,6 +89,14 @@ def test_round_trip_with_different_key_types(self, key):
assert verified_data['testkey'] == 'testvalue'


class TestJWK(object):
def test_jwk(self, payload):
key_data = 'key'
key = jwk.construct(key_data, algorithm='HS256')
token = jws.sign(payload, key, algorithm=ALGORITHMS.HS256)
assert jws.verify(token, key_data, ALGORITHMS.HS256) == payload


class TestHMAC(object):

def testHMAC256(self, payload):
Expand Down Expand Up @@ -272,6 +280,10 @@ def test_tuple(self):
def test_list(self):
assert ['test', 'key'] == jws._get_keys(['test', 'key'])

def test_jwk(self):
jwkey = jwk.construct('key', algorithm='HS256')
assert (jwkey,) == jws._get_keys(jwkey)


class TestRSA(object):

Expand Down

0 comments on commit 60fa95d

Please sign in to comment.