def test_password_reset_success(): clear() # Register 2 users for coverage auth_register("*****@*****.**", "password", "Wilson", "Doe")['u_id'] auth_register("*****@*****.**", "password", "Wilson", "Doe")['u_id'] user = auth_login("*****@*****.**", "password") # Retrieve the reset code reset_code = encoded_resetcode("*****@*****.**") # Reset the password auth_passwordreset_reset(reset_code, "newpassword") # Assert that the new password is updated by checking if the hashed versions are the same auth_logout(user['token']) user = auth_login("*****@*****.**", "newpassword") assert user == { 'u_id': 1, 'token': user['token'], }
def test_successful_logout(register_login): token = token_hash(0) assert auth_logout(token) == {'is_success': True}
def test_unsuccessful_logout(register_login): token = token_hash(1) assert auth_logout(token) == {'is_success': False}
def test_empty_token(register_login): token = token_hash(1) assert auth_logout(token) == {'is_success': False}
def auth_logout_flask(): payload = request.get_json() token = payload['token'] return dumps(a.auth_logout(token))