MCPcopy Create free account
hub / github.com/mpdavis/python-jose / TestGetKeys

Class TestGetKeys

tests/test_jws.py:258–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256
257
258class TestGetKeys:
259 def test_dict(self):
260 assert ({},) == jws._get_keys({})
261
262 def test_custom_object(self):
263 class MyDict(dict):
264 pass
265
266 mydict = MyDict()
267 assert (mydict,) == jws._get_keys(mydict)
268
269 def test_RFC7517_string(self):
270 key = '{"keys": [{}, {}]}'
271 assert [{}, {}] == jws._get_keys(key)
272
273 def test_RFC7517_jwk(self):
274 key = {"kty": "hsa", "k": "secret", "alg": "HS256", "use": "sig"}
275 assert (key,) == jws._get_keys(key)
276
277 def test_RFC7517_mapping(self):
278 key = {"keys": [{}, {}]}
279 assert [{}, {}] == jws._get_keys(key)
280
281 def test_string(self):
282 assert ("test",) == jws._get_keys("test")
283
284 def test_tuple(self):
285 assert ("test", "key") == jws._get_keys(("test", "key"))
286
287 def test_list(self):
288 assert ["test", "key"] == jws._get_keys(["test", "key"])
289
290 def test_jwk(self):
291 jwkey = jwk.construct("key", algorithm="HS256")
292 assert (jwkey,) == jws._get_keys(jwkey)
293
294
295@pytest.mark.skipif(RSAKey is None, reason="RSA is not available")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…