示例#1
0
 def test_encode(self):
     payload = {'foo': 'bar'}
     self.assertRaises(MissingRequiredClaimError, encode, payload)
     # force all mandatory claims into the payload
     payload = {k: 'foo' for k in MANDATORY_CLAIMS}
     self.assertEqual(encode(payload),
                      jwt_encode(payload, settings.SECRET_KEY))
示例#2
0
 def jwt(self):
     """Encode the token claims into a JWT."""
     return encode(self.claims)