Example #1
0
def run_tests():
    # Cleanup
    fhqtest.clean_all_quests()

    gameid = fhqtest.find_first_gameid()

    # TODO symlinks to quests_create
    quest_name = fhqtest.generate_random(255).strip()
    quest_text = fhqtest.generate_random(300).strip()
    quest_answer = fhqtest.generate_random(255).strip()
    quest_answer_format = fhqtest.generate_random(255).strip()
    quest_author = fhqtest.generate_random(50).strip()
    quest_state = "open"
    quest_subject = "trivia"
    quest_score = 555
    quest_description_state = fhqtest.generate_random(255).strip()
    quest_copyright = fhqtest.generate_random(100).strip()

    fhqtest.print_bold("Try create quest...")
    quest1 = fhqtest.admin_session.createquest({
        "uuid": fhqtest.QUEST_UUID1,
        "gameid": gameid,
        "name": quest_name,
        "text": quest_text,
        "score": quest_score,
        "author": quest_author,
        "subject": quest_subject,
        "answer": quest_answer,
        "answer_format": quest_answer_format,
        "state": quest_state,
        "description_state": quest_description_state,
        "copyright": quest_copyright,
    })
    fhqtest.alert(quest1 == None, 'Could not get response (2)')
    fhqtest.check_response(quest1, "Quest succesfull created")
    questid1 = quest1['questid']

    quest1_new = fhqtest.admin_session.quest({"questid": questid1})
    quest1_new_hints = quest1_new['hints']
    quest1_new_files = quest1_new['files']
    quest1_new_game = quest1_new['game']
    quest1_new = quest1_new['quest']
    pprint(quest1_new)

    fhqtest.check_values("name of quest", quest1_new['name'], quest_name)
    fhqtest.check_values("author of quest", quest1_new['author'], quest_author)
    fhqtest.check_values("answer of quest", quest1_new['answer'], quest_answer)
    fhqtest.check_values("answer format of quest", quest1_new['answer_format'], quest_answer_format)
    fhqtest.check_values("description_state of quest", quest1_new['description_state'], quest_description_state)
    fhqtest.check_values("score of quest", quest1_new['score'], quest_score)
    fhqtest.check_values("state of quest", quest1_new['state'], quest_state)
    fhqtest.check_values("subject of quest", quest1_new['subject'], quest_subject)
    fhqtest.check_values("text of quest", quest1_new['text'], quest_text)
    fhqtest.check_values("copyright of quest", quest1_new['copyright'], quest_copyright)

    quest1_hint1 = fhqtest.generate_random(255).strip()
    quest1_hint2 = fhqtest.generate_random(255).strip()
    quest1_hint3 = fhqtest.generate_random(255).strip()

    fhqtest.print_bold("Add hint to quest...")
    h1 = fhqtest.admin_session.addhint({"questid": questid1, "hint": quest1_hint1})
    fhqtest.alert(h1 == None, 'Could not get response (hint1)')
    fhqtest.check_response(h1, "Quest hint succesfull created")
    pprint(h1)

    h2 = fhqtest.admin_session.addhint({"questid": questid1, "hint": quest1_hint2})
    fhqtest.alert(h2 == None, 'Could not get response (hint2)')
    fhqtest.check_response(h2, "Quest hint succesfull created")
    pprint(h2)

    h3 = fhqtest.admin_session.addhint({"questid": questid1, "hint": quest1_hint3})
    fhqtest.alert(h3 == None, 'Could not get response (hint3)')
    fhqtest.check_response(h3, "Quest hint succesfull created")
    pprint(h3) # TODO return id and text

    fhqtest.print_bold("Try update quest...")
    quest_name2 = fhqtest.generate_random(255).strip()
    quest_text2 = fhqtest.generate_random(300).strip()
    quest_answer2 = fhqtest.generate_random(255).strip()
    quest_answer_format2 = fhqtest.generate_random(255).strip()
    quest_author2 = fhqtest.generate_random(50).strip()
    quest_state2 = "broken"
    quest_subject2 = "stego"
    quest_score2 = 456
    quest_description_state2 = fhqtest.generate_random(255).strip()
    quest_copyright2 = fhqtest.generate_random(100).strip()

    quest1_update = fhqtest.admin_session.quest_update({
        "questid": questid1,
        "name": quest_name2,
        "gameid": gameid,
        "text": quest_text2,
        "score": quest_score2,
        "author": quest_author2,
        "subject": quest_subject2,
        "answer": quest_answer2,
        "answer_format": quest_answer_format2,
        "state": quest_state2,
        "description_state": quest_description_state2,
        "copyright": quest_copyright2,
    })
    fhqtest.alert(quest1_update == None, 'Could not get response (4)')
    fhqtest.check_response(quest1_update, "Quest succesfull update")
    
    quest1_updated = fhqtest.admin_session.quest({"questid": questid1})
    quest1_updated_hints = quest1_updated['hints']
    quest1_updated_files = quest1_updated['files']
    quest1_updated_game = quest1_updated['game']
    quest1_updated = quest1_updated['quest']
    print("quest1_updated = " + str(quest1_updated))

    fhqtest.check_values("name of quest", quest1_updated['name'], quest_name2)
    fhqtest.check_values("author of quest", quest1_updated['author'], quest_author2)
    fhqtest.check_values("answer of quest", quest1_updated['answer'], quest_answer2)
    fhqtest.check_values("answer format of quest", quest1_updated['answer_format'], quest_answer_format2)
    fhqtest.check_values("description_state of quest", quest1_updated['description_state'], quest_description_state2)
    fhqtest.check_values("score of quest", quest1_updated['score'], quest_score2)
    fhqtest.check_values("state of quest", quest1_updated['state'], quest_state2)
    fhqtest.check_values("subject of quest", quest1_updated['subject'], quest_subject2)
    fhqtest.check_values("text of quest", quest1_updated['text'], quest_text2)
    fhqtest.check_values("copyright of quest", quest1_updated['copyright'], quest_copyright2)

    fhqtest.check_values("hint1 of quest", quest1_updated_hints[0]['text'], quest1_hint1)
    fhqtest.check_values("hint2 of quest", quest1_updated_hints[1]['text'], quest1_hint2)
    fhqtest.check_values("hint3 of quest", quest1_updated_hints[2]['text'], quest1_hint3)

    # try remove hint
    h2_remove = fhqtest.admin_session.deletehint({"hintid": quest1_updated_hints[1]['id']})
    fhqtest.alert(h2_remove == None, 'Could not get response (hint2_remove)')
    fhqtest.check_response(h2_remove, "Quest hint2 succesfull removed")

    fhqtest.print_bold("Try upload file to quest...")
    # pprint(quest1_updated)
    quest_uuid = quest1_updated['uuid']
    resp = fhqtest.admin_session.quests_files_upload({
        "quest_uuid": quest_uuid,
        "file_base64": "SGVsbG8gd29ybGQh",
        "file_name": "test1.txt",
    })
    fhqtest.alert(resp['result'] == 'FAIL', 'Wrong response')
    fhqtest.check_response(resp, "Quest quests_files_upload succesfull")

    questid = quest1_updated['id']
    resp = fhqtest.admin_session.quests({"gameid": gameid})
    fhqtest.alert(resp == None, 'Could not get response (quests)')
    fhqtest.check_response(resp, "quest get filtered")
    fhqtest.alert(resp['result'] == 'FAIL', 'Wrong response')
    fhqtest.alert(resp['data'][0]['questid'] != questid, 'Wrong work filter by gameid in request quests')

    # 
    fhqtest.print_bold("Try answerlist...")
    r_answerlist = fhqtest.admin_session.answerlist({"page": 0, "onpage": 10})
    fhqtest.alert(r_answerlist == None, 'Could not get response (r_answerlist)')
    fhqtest.check_response(r_answerlist, "Answer list succesfull got")
    pprint(r_answerlist)
    # TODO check this


    # Cleanup
    fhqtest.clean_all_quests()
Example #2
0
def run_tests():
    # Cleanup
    fhqtest.print_bold("Clean up test data... ")
    game2 = fhqtest.admin_session.game_info({"uuid": fhqtest.GAME_UUID2})
    fhqtest.alert(game2 == None, 'Could not get response')
    if game2['result'] == "DONE":
        game2_delete_r = fhqtest.admin_session.game_delete({
            "uuid":
            fhqtest.GAME_UUID2,
            "admin_password":
            fhqtest.ADMIN_PASSWORD
        })
        fhqtest.alert(game2_delete_r == None,
                      'Could not get response (game_delete)')
        if game2_delete_r['result'] == 'FAIL':
            fhqtest.log_err("Could not delete prevously game: " +
                            str(game2_delete_r))
            raise ValueError('Could not delete prevously game')
    fhqtest.print_success("Cleaned")

    game_name = fhqtest.generate_random(255)
    game_description = fhqtest.generate_random(300)
    game_teams = fhqtest.generate_random(255)
    game_state = "original"
    game_form = "online"
    game_type = "jeopardy"
    game_date_start = "2000-01-01 00:00:00"
    game_date_stop = "2001-01-01 00:00:00"
    game_date_restart = "2011-01-01 00:00:00"

    # test create game
    fhqtest.print_bold("Try create game...")
    game2 = fhqtest.admin_session.game_create({
        "uuid": fhqtest.GAME_UUID2,
        "name": game_name,
        "description": game_description,
        "state": game_state,
        "form": game_form,
        "type": game_type,
        "date_start": game_date_start,
        "date_stop": game_date_stop,
        "date_restart": game_date_restart,
        "organizators": game_teams
    })
    fhqtest.alert(game2 == None, 'Could not get response (2)')
    fhqtest.check_response(game2, "Game succesfull created")

    if game2['result'] == 'FAIL':
        raise ValueError('Could not create game')

    # test find game
    fhqtest.print_bold("Find game by uuid... ")
    game2 = fhqtest.admin_session.game_info({"uuid": fhqtest.GAME_UUID2})
    fhqtest.alert(game2 == None, 'Could not get response')
    fhqtest.check_response(game2, "Game found")

    game2 = game2['data']

    fhqtest.check_values("name of game", game2['name'], game_name)
    fhqtest.check_values("organizators of game", game2['organizators'],
                         game_teams)
    fhqtest.check_values("form of game", game2['form'], game_form)
    fhqtest.check_values("state of game", game2['state'], game_state)
    fhqtest.check_values("type of game", game2['type'], game_type)
    fhqtest.check_values("description of game", game2['description'],
                         game_description)
    fhqtest.check_values("maxscore of game", game2['maxscore'], 0)

    # gameid = game2['local_id']
    # print("gameid: " + str(gameid))

    # list of games
    fhqtest.print_bold("Get list of games... ")
    games_list = fhqtest.admin_session.games({})
    fhqtest.alert(game2 == None, 'Could not get response')
    fhqtest.check_response(games_list, "Games list got")
    bFound = False
    for game_ in games_list['data']:
        if game_['uuid'] == fhqtest.GAME_UUID2:
            bFound = True

    if bFound != True:
        fhqtest.log_err("Game not found in list")
    else:
        fhqtest.print_success("Game found in list")
    '''
    Update game name
    '''
    game_name = fhqtest.generate_random(255)
    fhqtest.print_bold("Update game... ")
    game_updt = fhqtest.admin_session.game_update({
        "uuid": fhqtest.GAME_UUID2,
        "name": game_name,
    })
    fhqtest.alert(game_updt == None, 'Could not get response')
    if game_updt['result'] == 'FAIL':
        fhqtest.log_err(game_updt['error'])
    else:
        game2_new = fhqtest.admin_session.game_info(
            {"uuid": fhqtest.GAME_UUID2})
        fhqtest.print_bold("Check name after update... ")
        fhqtest.check_response(game2_new, "Games list got")
        game2_new = game2_new['data']

        fhqtest.print_bold("Check the game updated name... ")
        if game2_new['name'] != game_name:
            fhqtest.log_err("Game updated has wrong name expected '" +
                            game_name + "' got '" + game2_new['name'] + "'")
        else:
            fhqtest.print_success("Game the game updated name ok")

        fhqtest.print_bold("Check the game updated organizators... ")
        if game2_new['organizators'] != game_teams:
            fhqtest.log_err("Game updated has wrong organizators expected '" +
                            game_teams + "' got '" +
                            game2_new['organizators'] + "'")
        else:
            fhqtest.print_success("Game the game updated organizators ok")

        fhqtest.print_bold("Check the game updated description... ")
        if game2_new['description'] != game_description:
            fhqtest.log_err("Game updated has wrong description expected '" +
                            game_description + "' got '" +
                            game2_new['description'] + "'")
        else:
            fhqtest.print_success("Game the game updated description ok")

        fhqtest.print_bold("Check the game updated maxscore... ")
        if game2_new['maxscore'] != 0:
            fhqtest.log_err(
                "Game updated has wrong maxscore expected '0' got '" +
                str(game2_new['maxscore']) + "'")
        else:
            fhqtest.print_success("Game the game updated maxscore ok")

    # TODO upload log for test game
    fhqtest.print_bold("Game update logo test... ")
    f = open("files/game1.png", 'rb')
    image_png_base64 = f.read()
    f.close()
    img_len = len(image_png_base64)
    if img_len != 17045:
        fhqtest.log_err("Game Logo wrong size, current " + str(img_len) +
                        ", but expected 17045")
    image_png_base64 = base64.b64encode(image_png_base64)
    image_png_base64 = image_png_base64.decode("utf-8")
    game_img = fhqtest.admin_session.game_update_logo({
        "uuid":
        fhqtest.GAME_UUID2,
        "image_png_base64":
        image_png_base64
    })
    fhqtest.alert(game_img == None, 'Could not get response')
    fhqtest.check_response(game_img, "Game Logo updated")

    # cleanup export files
    fhqtest.print_bold("Game cleanup export test... ")
    tmp_dir_unpack_zip = fhqtest.TMP_DIR + '/game2'
    game_zip_path = fhqtest.TMP_DIR + '/game_' + fhqtest.GAME_UUID2 + '.zip'

    if os.path.isdir(tmp_dir_unpack_zip):
        shutil.rmtree(tmp_dir_unpack_zip)

    if os.path.exists(game_zip_path):
        os.remove(game_zip_path)

    # export
    fhqtest.print_bold("Game export test... ")
    game_exp = fhqtest.admin_session.game_export({"uuid": fhqtest.GAME_UUID2})
    fhqtest.alert(game_exp == None, 'Could not get response')
    fhqtest.check_response(game_exp, "Game exported")
    if 'game_' + fhqtest.GAME_UUID2 + '.zip' != game_exp['data'][
            'zipfile_name']:
        fhqtest.log_err("zipfile_name for game is wrong ")
    game_zip = base64.b64decode(game_exp['data']['zipfile_base64'])
    f = open(game_zip_path, 'wb')
    f.write(game_zip)
    f.close()

    zip_ref = zipfile.ZipFile(game_zip_path, 'r')
    zip_ref.extractall(tmp_dir_unpack_zip)
    zip_ref.close()

    img_exported_path = tmp_dir_unpack_zip + '/' + fhqtest.GAME_UUID2 + '.png'
    json_exported_path = tmp_dir_unpack_zip + '/' + fhqtest.GAME_UUID2 + '.json'

    if not os.path.exists(img_exported_path):
        fhqtest.log_err("Not found image in zip " + img_exported_path)

    if not os.path.exists(json_exported_path):
        fhqtest.log_err("Not found json in zip " + json_exported_path)
    else:
        with open(json_exported_path) as f:
            game2_exported = json.load(f)
            # pprint(game2_exported)

        fhqtest.print_bold("Check the export game name... ")
        if game2_exported['name'] != game_name:
            fhqtest.log_err("Exported game has wrong name expected '" +
                            game_name + "' got '" + game2_exported['name'] +
                            "'")
        else:
            fhqtest.print_success("Exported game name ok")

        fhqtest.print_bold("Check the export game organizators... ")
        if game2_exported['organizators'] != game_teams:
            fhqtest.log_err("Exported game has wrong organizators expected '" +
                            game_teams + "' got '" +
                            game2_exported['organizators'] + "'")
        else:
            fhqtest.print_success("Exported game organizators ok")

        fhqtest.print_bold("Check the export game description... ")
        if game2_exported['description'] != game_description:
            fhqtest.log_err("Exported game has wrong description expected '" +
                            game_description + "' got '" +
                            game2_exported['description'] + "'")
        else:
            fhqtest.print_success("Exported game description ok")

        fhqtest.print_bold("Check the export game maxscore... ")
        if game2_exported['maxscore'] != 0:
            fhqtest.log_err(
                "Exported game has wrong maxscore expected '0' got '" +
                str(game2_exported['maxscore']) + "'")
        else:
            fhqtest.print_success("Exported game maxscore ok")

        gameid = game2_exported['local_id']

    # print(game_exp)

    # remove game
    fhqtest.print_bold("Remove game by uuid... ")
    resp = fhqtest.admin_session.game_delete({
        "uuid":
        fhqtest.GAME_UUID2,
        "admin_password":
        fhqtest.ADMIN_PASSWORD
    })
    fhqtest.check_response(resp, "Game removed")

    fhqtest.check_response(resp, "TODO Game import")
    '''
Example #3
0
def run_tests():

    fhqtest.clean_all_classbooks()

    records = []
    for _ in range(10):
        records.append({
            'name': fhqtest.generate_random(10),
            'content': fhqtest.generate_random(255),
            'uuid': fhqtest.generate_random_uuid(),
        })

    fhqtest.print_bold("Create new records")
    parentids = []
    parentids.append(0) # root
    for rec in records:
        rec['parentid'] = random.choice(parentids)
        r = fhqtest.admin_session.classbook_add_record({
            "parentid": rec['parentid'],
            "name": rec['name'],
            "content": rec['content'],
            "uuid": rec['uuid'],
            "ordered": 0
        })
        fhqtest.check_response(r, "Record " + rec['uuid'] + " succesfull in parent " + str(rec['parentid']) + " created")
        if r['result'] == 'FAIL':
            raise ValueError('Could not create new classbook')

        rec['classbookid'] = r['data']['classbookid']
        parentids.append(rec['classbookid'])

    # pprint(records)
    # Cleanup
    ''' user1 = None
    user2 = None
    user3 = None


    fhqtest.print_bold("Clean up test data... ")
    users = fhqtest.admin_session.users({"onpage": 10, "page": 0, "filter_text": "user1"})
    users_count = users["count"]
    for usr in users["data"]:
        if usr['email'] == "user1":
            user1 = usr
        if usr['created'] == '':
            fhqtest.log_err("Field created could not be empty for user #" + str(usr['id']))
            exit(-1)

    users = fhqtest.admin_session.users({"onpage": 10, "page": 0, "filter_text": "user2"})
    users_count = users["count"]
    for usr in users["data"]:
        if usr['email'] == "user2":
            user2 = usr
        if usr['created'] == '':
            fhqtest.log_err("Field created could not be empty for user #" + str(usr['id']))
            exit(-1)

    users = fhqtest.admin_session.users({"onpage": 10, "page": 0, "filter_text": "user3"})
    users_count = users["count"]
    for usr in users["data"]:
        if usr['email'] == "user3":
            user3 = usr
        if usr['created'] == '':
            fhqtest.log_err("Field created could not be empty for user #" + str(usr['id']))
            exit(-1)

    users = fhqtest.admin_session.users({"onpage": 10, "page": 0, "filter_text": "user3_test"})
    users_count = users["count"]
    for usr in users["data"]:
        if usr['email'] == "user3_test":
            user3_test = usr
        if usr['created'] == '':
            fhqtest.log_err("Field created could not be empty for user #" + str(usr['id']))
            exit(-1)

    if user1 != None:
        user1_delete = fhqtest.admin_session.user_delete({
            "userid": user1['id'], 
            "password": fhqtest.ADMIN_PASSWORD
        })
        fhqtest.check_response(user1_delete, "User1 succesfull removed")
        user1 = None

    if user2 != None:
        fhqtest.admin_session.user_delete({"userid": user2['id'], "password": fhqtest.ADMIN_PASSWORD})
        user2 = None

    if user3 != None:
        fhqtest.admin_session.user_delete({"userid": user3['id'], "password": fhqtest.ADMIN_PASSWORD})
        user3 = None

    if user3_test != None:
        fhqtest.admin_session.user_delete({"userid": user3_test['id'], "password": fhqtest.ADMIN_PASSWORD})
        user3_test = None
    fhqtest.print_success("Cleaned")

    # test create users
    fhqtest.print_bold("Try create user1...")
    user1 = fhqtest.admin_session.users_add({
        "uuid": fhqtest.USER1_UUID,
        "email": "user1",
        "nick": "nick_user1",
        "password": "******",
        "role": "user"
    })

    fhqtest.alert(user1 == None, 'Could not get response (users_add/user1)')
    fhqtest.check_response(user1, "User1 succesfull created")

    fhqtest.print_bold("Try create user2...")
    user2 = fhqtest.admin_session.users_add({
        "uuid": fhqtest.USER2_UUID,
        "email": "user2",
        "nick": "nick_user2",
        "password": "******",
        "role": "user"
    })

    fhqtest.alert(user2 == None, 'Could not get response (users_add/user2)')
    fhqtest.check_response(user1, "User2 succesfull created")

    fhqtest.print_bold("Try create user3...")
    user3 = fhqtest.admin_session.users_add({
        "uuid": fhqtest.USER3_UUID,
        "email": "user3",
        "nick": "nick_user3",
        "password": "******",
        "role": "user"
    })

    fhqtest.alert(user3 == None, 'Could not get response (users_add/user3)');
    fhqtest.check_response(user1, "User3 succesfull created")

    fhqtest.print_bold("Check unique user3 by email...")
    user3_again = fhqtest.admin_session.users_add({
        "uuid": fhqtest.USER3_UUID,
        "email": "user3",
        "nick": "nick_user3_again",
        "password": "******",
        "role": "user"
    })

    fhqtest.alert(user3_again == None, 'Could not get response (users_add/user3 again)')
    if user3_again['result'] == "DONE":
        fhqtest.log_err("Wrong creating user email must be unique")
    else:
        fhqtest.print_success("User3 again - OK")

    fhqtest.print_bold("Check unique user by uuid...")
    user3_again2 = fhqtest.admin_session.users_add({"uuid": fhqtest.USER3_UUID, "email": "user3_test", "nick": "nick_user3_again", "password": "******", "role": "user"})
    fhqtest.alert(user3_again2 == None, 'Could not get response (users_add/user3 again2)')
    if user3_again2['result'] == "DONE":
        fhqtest.log_err("Wrong creating user uuid must be unique")
    else:
        fhqtest.print_success("User3 again - OK")

    fhqtest.print_bold("Find user by nick...")
    users = fhqtest.admin_session.users({"onpage": 10, "page": 0, "filter_text": "nick_user2"})
    users_count = users["count"]
    user_found = None
    for usr in users["data"]:
        if usr['email'] == "user2":
            user_found = usr
    fhqtest.alert(user_found == None, 'Could not find user2')
    if user_found != None:
        fhqtest.print_success("User2 found success - OK")

    fhqtest.print_bold("Update user country... ")
    fhqtest.alert(user_found["country"] != "", 'User country must be empty ')

    user2_update = fhqtest.admin_session.user_update({
        "userid": user_found["id"],
        "country": "Some country",
        "university": "Some university",
    })
    fhqtest.alert(user2_update == None, 'Could not find user2')
    fhqtest.check_response(user2_update, "User2 succesfull updated")
    user2_update = user2_update["data"]
    if "country" not in user2_update:
        fhqtest.log_err("Not found field 'country' in response after user update")
        exit(-1)
    elif user2_update["country"] != "Some country":
        fhqtest.log_err("Field 'country' expected value of 'Some country'")
        exit(-1)
    if "university" not in user2_update:
        fhqtest.log_err("Not found field 'university' in response after user update")
        exit(-1)
    elif  user2_update["university"] != "Some university":
        fhqtest.log_err("Field 'university' expected value of 'Some university'")
        exit(-1)
    if "nick" not in user2_update:
        fhqtest.log_err("Not found field 'nick' in response after user update")
        exit(-1)
    if "about" not in user2_update:
        fhqtest.log_err("Not found field 'about' in response after user update")
        exit(-1)
    if "created" not in user2_update:
        fhqtest.log_err("Not found field 'created' in response after user update")
        exit(-1)
    if "region" not in user2_update:
        fhqtest.log_err("Not found field 'region' in response after user update")
        exit(-1)
    if "email" not in user2_update:
        fhqtest.log_err("Not found field 'email' in response after user update")
        exit(-1)
    if "role" not in user2_update:
        fhqtest.log_err("Not found field 'role' in response after user update")
        exit(-1)
    # TODO
    # if "updated" not in user2_update:
    #     fhqtest.log_err("Not found field 'updated' in response after user update")
    #     exit(-1)
    if "uuid" not in user2_update:
        fhqtest.log_err("Not found field 'uuid' in response after user update")
        exit(-1)

    fhqtest.print_bold("Login by user2... ")
    user2_session = FreeHackQuestClient(fhqtest.TEST_SERVER)
    user2_login = user2_session.login({"email": "user2", "password": "******"})
    fhqtest.alert(user2_login == None, 'Could not login as user2')
    fhqtest.alert(user2_login['result'] == 'FAIL', 'Could not login as user2 (fail)')
    if user2_login['result'] == 'DONE':
        fhqtest.print_success("User2 login success - OK")
        user2_session.close()
        user2_session = None


    # deprecated method
    user2_found1 = fhqtest.admin_session.user({"userid": user_found["id"]})
    fhqtest.alert(user2_found1 == None, 'Could not get user2')
    fhqtest.check_response(user2_found1, "User2 succesfull got (1)")
    user2_found1 = user2_found1['data']
    if "email" not in user2_found1:
        fhqtest.log_err("Not found field 'email' in response user2_found1")
        exit(-1)
    elif user2_found1['email'] != 'user2':
        fhqtest.log_err("Expected field 'email' value 'user2', but got '" + user2_found1['email'] + "'")
        exit(-1)

    # TODO
    user2_found2 = fhqtest.admin_session.users_info({"uuid": user_found["id"]})
    fhqtest.alert(user2_found2 == None, 'Could not get user2')
    fhqtest.check_response(user2_found2, "User2 succesfull got (2)")
    if "email" not in user2_found1:
        fhqtest.log_err("Not found field 'email' in response user2_found1")
        exit(-1)
    elif user2_found1['email'] != 'user2':
        fhqtest.log_err("Expected field 'email' value 'user2', but got '" + user2_found1['email'] + "'")
        exit(-1)
    '''
    fhqtest.clean_all_classbooks()