Skip to content

Commit 60fa95d

Browse files
committed
Test loading JWK directly
1 parent 89c3d41 commit 60fa95d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_jws.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ def test_round_trip_with_different_key_types(self, key):
8989
assert verified_data['testkey'] == 'testvalue'
9090

9191

92+
class TestJWK(object):
93+
def test_jwk(self, payload):
94+
key_data = 'key'
95+
key = jwk.construct(key_data, algorithm='HS256')
96+
token = jws.sign(payload, key, algorithm=ALGORITHMS.HS256)
97+
assert jws.verify(token, key_data, ALGORITHMS.HS256) == payload
98+
99+
92100
class TestHMAC(object):
93101

94102
def testHMAC256(self, payload):
@@ -272,6 +280,10 @@ def test_tuple(self):
272280
def test_list(self):
273281
assert ['test', 'key'] == jws._get_keys(['test', 'key'])
274282

283+
def test_jwk(self):
284+
jwkey = jwk.construct('key', algorithm='HS256')
285+
assert (jwkey,) == jws._get_keys(jwkey)
286+
275287

276288
class TestRSA(object):
277289

0 commit comments

Comments
 (0)