Fix test not passing after changing generate_token method