def test_verify_raises_error_while_decoding_with_verification(self): partial_test_claims = dict( email='*****@*****.**', issued_at=time() - 120) # this is to force the token to expire. test_jwt = AuthResponseHelper.generate_test_jwt(**partial_test_claims) with self.assertRaises(InvalidTokenError): with AuthResponseHelper(): authenticator = Authenticator() authenticator.verify_jwt(test_jwt)
def test_verify_ok(self): partial_test_claims = dict(email='*****@*****.**', issued_at=time()) test_jwt = AuthResponseHelper.generate_test_jwt(**partial_test_claims) test_claims = AuthResponseHelper.generate_test_claims( **partial_test_claims) with AuthResponseHelper(): authenticator = Authenticator() result = authenticator.verify_jwt(test_jwt) self.assertEqual(test_claims, result)