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))
def jwt(self): """Encode the token claims into a JWT.""" return encode(self.claims)