MCPcopy
hub / github.com/authlib/authlib / test_invalid_header

Function test_invalid_header

tests/jose/test_jwe.py:33–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31
32
33def test_invalid_header():
34 jwe = JsonWebEncryption()
35 public_key = read_file_path("rsa_public.pem")
36 with pytest.raises(errors.MissingAlgorithmError):
37 jwe.serialize_compact({}, "a", public_key)
38 with pytest.raises(errors.UnsupportedAlgorithmError):
39 jwe.serialize_compact(
40 {"alg": "invalid"},
41 "a",
42 public_key,
43 )
44 with pytest.raises(errors.MissingEncryptionAlgorithmError):
45 jwe.serialize_compact(
46 {"alg": "RSA-OAEP"},
47 "a",
48 public_key,
49 )
50 with pytest.raises(errors.UnsupportedEncryptionAlgorithmError):
51 jwe.serialize_compact(
52 {"alg": "RSA-OAEP", "enc": "invalid"},
53 "a",
54 public_key,
55 )
56 with pytest.raises(errors.UnsupportedCompressionAlgorithmError):
57 jwe.serialize_compact(
58 {"alg": "RSA-OAEP", "enc": "A256GCM", "zip": "invalid"},
59 "a",
60 public_key,
61 )
62
63
64def test_not_supported_alg():

Callers

nothing calls this directly

Calls 3

serialize_compactMethod · 0.95
JsonWebEncryptionClass · 0.90
read_file_pathFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…