def test_unprotected(self): jwe = { 'iv': '1234', 'ciphertext': 'hello', 'tag': '4567', 'recipients': [{}], 'unprotected': self.raw_claims, } self.assertDictEqual(jose.get_jwe_shared_header(jwe), self.raw_claims)
def test_protected(self): jwe = { 'iv': '1234', 'ciphertext': 'hello', 'tag': '4567', 'recipients': [{}], 'protected': utils.base64url_encode(json.dumps(self.raw_claims)), } self.assertDictEqual(jose.get_jwe_shared_header(jwe), self.raw_claims)
def test_invalid_jwe(self): with self.assertRaises(exceptions.InvalidFormatError): jose.get_jwe_shared_header({})