MCPcopy Create free account
hub / github.com/authlib/authlib / test_validate_header

Function test_validate_header

tests/jose/test_jws.py:210–226  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

208
209
210def test_validate_header():
211 jws = JsonWebSignature(private_headers=[])
212 protected = {"alg": "HS256", "invalid": "k"}
213 header = {"protected": protected, "header": {"kid": "a"}}
214 with pytest.raises(errors.InvalidHeaderParameterNameError):
215 jws.serialize(
216 header,
217 b"hello",
218 "secret",
219 )
220 jws = JsonWebSignature(private_headers=["invalid"])
221 s = jws.serialize(header, b"hello", "secret")
222 assert isinstance(s, dict)
223
224 jws = JsonWebSignature()
225 s = jws.serialize(header, b"hello", "secret")
226 assert isinstance(s, dict)
227
228
229def test_validate_crit_header_with_serialize():

Callers

nothing calls this directly

Calls 2

serializeMethod · 0.95
JsonWebSignatureClass · 0.90

Tested by

no test coverage detected