def test_verify_refresh_token(self): token = jwt.create_refresh_token(self.user_id, self.agent) bad_token = token[:len(token) - 3] self.assertTrue( jwt.verify_refresh_token(token, self.user_id, self.agent)) self.assertFalse( jwt.verify_refresh_token(bad_token, self.user_id, self.agent))
def test_verify_refresh_token(self): token = jwt.create_refresh_token(self.user_id, self.agent) bad_token = token[:len(token)-3] self.assertTrue( jwt.verify_refresh_token(token, self.user_id, self.agent) ) self.assertFalse( jwt.verify_refresh_token(bad_token, self.user_id, self.agent) )
def get_refresh_token(): user = api.helpers.get_user() user_id = user.id agent = request.headers.get('User-Agent') token = jwt.create_refresh_token(user_id, agent) xhr = MakeResponse(200) res = dict(refresh_token=token) xhr.set_body(res) return xhr.response
def test_create_refresh_token(self): with self.assertRaises(ValueError): jwt.create_refresh_token(self.user_id, None)