def test_eso_query_post_dungeon_run(self): db_cursor = QueryEsoDungeonTable() # check current highest run id: last_added_run_id = db_cursor.eso_get_id_of_last_added_record() payload = { c.ESO_FORM_KEY_SUBMIT_DUNGEON_RUN_DATA: { c.ESO_FORM_KEY_CLASS_FOUR: c.CLASS_DRAGONKNIGHT, c.ESO_FORM_KEY_CLASS_ONE: c.CLASS_NECRO, c.ESO_FORM_KEY_CLASS_THREE: c.CLASS_WARDEN, c.ESO_FORM_KEY_CLASS_TWO: c.CLASS_SORCERER, c.ESO_FORM_KEY_DUNGEON_NAME: c.DUNGEON_ARX_CORINIUM, c.ESO_FORM_KEY_FLAWLESS: c.ESO_NO, c.ESO_FORM_KEY_HARDMODE: c.ESO_NO, c.ESO_FORM_KEY_PLAYER_COUNT: 4, c.ESO_FORM_KEY_TIME_NEEDED: 20, c.ESO_FORM_KEY_WIPES: 0 } } response = h.api_post_request( constants.FLASK_BACKEND_URL + constants.API_ESO_POST_DUNGEON_RUN, payload) assert response is not None assert response.status_code == 200 # now a new id must have been created (autoincrement of DB) new_last_added_run_id = db_cursor.eso_get_id_of_last_added_record() assert new_last_added_run_id != last_added_run_id # delete added run status = db_cursor.eso_delete_last_added_record_query() assert status == 200
def test_get_ai_battle_data_with_ai_count(self): for ai_count in range(2, 9): payload = {shc_c.SHC_KEY_AI_BATTLE_PLAYER_COUNT: ai_count} response = h.api_post_request( c.FLASK_BACKEND_URL + c.API_STRONGHOLD_GET_AI_BATTLE, payload) assert response is not None assert response.status_code == 200
def test_eso_query_post_raid_run(self): db_cursor = QueryEsoRaidTable() # check current highest run id: last_added_run_id = db_cursor.eso_get_id_of_last_added_record() payload = { c.ESO_FORM_KEY_RAID_RUN_FORM_DATA: { c.ESO_FORM_KEY_RAID_NAME: c.RAID_SUNSPIRE, c.ESO_FORM_KEY_PLAYER_COUNT: 12, c.ESO_FORM_KEY_TIME_NEEDED: 60, c.ESO_FORM_KEY_HARDMODE: c.ESO_YES, c.ESO_FORM_KEY_FLAWLESS: c.ESO_NO, c.ESO_FORM_KEY_WIPES: 0, c.ESO_FORM_KEY_CLASS_ONE: c.CLASS_DRAGONKNIGHT, c.ESO_FORM_KEY_CLASS_TWO: c.CLASS_DRAGONKNIGHT, c.ESO_FORM_KEY_CLASS_THREE: c.CLASS_DRAGONKNIGHT, c.ESO_FORM_KEY_CLASS_FOUR: c.CLASS_SORCERER, c.ESO_FORM_KEY_CLASS_FIVE: c.CLASS_SORCERER, c.ESO_FORM_KEY_CLASS_SIX: c.CLASS_SORCERER, c.ESO_FORM_KEY_CLASS_SEVEN: c.CLASS_NIGHTBLADE, c.ESO_FORM_KEY_CLASS_EIGHT: c.CLASS_NIGHTBLADE, c.ESO_FORM_KEY_CLASS_NINE: c.CLASS_NIGHTBLADE, c.ESO_FORM_KEY_CLASS_TEN: c.CLASS_TEMPLAR, c.ESO_FORM_KEY_CLASS_ELEVEN: c.CLASS_TEMPLAR, c.ESO_FORM_KEY_CLASS_TWELVE: c.CLASS_TEMPLAR, c.ESO_FORM_KEY_NUM_TANKS: 2, c.ESO_FORM_KEY_NUM_DPS: 7, c.ESO_FORM_KEY_NUM_HEALS: 3, c.ESO_FORM_KEY_TOTAL_PARTY_DPS: 750000, c.ESO_FORM_KEY_TOTAL_PARTY_HPS: 120000 } } response = h.api_post_request( constants.FLASK_BACKEND_URL + constants.API_ESO_POST_RAID_RUN, payload) assert response is not None assert response.status_code == 200 # now a new id must have been created (autoincrement of DB) new_last_added_run_id = db_cursor.eso_get_id_of_last_added_record() assert new_last_added_run_id != last_added_run_id # delete added run status = db_cursor.eso_delete_last_added_record_query() assert status == 200
def test_api_post_request(self): test_json_payload = { c.KEY_HEALTH_CHECK_PAYLOAD: { 'test1': 123, 'test2': "abc" } } resp = h.api_post_request(c.FLASK_BACKEND_URL + c.API_HEALTH_CHECK, test_json_payload) assert resp is not None assert resp.status_code == c.RESP_OK msg = resp.json()[c.KEY_HEALTH_CHECK_RESPONSE] assert msg[c.KEY_STATUS] == c.RESP_OK assert msg[c.KEY_MESSAGE] == c.MSG_HEALTH_CHECK_SUCCESS assert msg[c.KEY_RECEIVED_PAYLOAD] == test_json_payload
def test_misc_brainstorm_get_exercise_list(self): payload = { c.MISC_KEY_DATA: { c.MISC_KEY_FORM_BRAINSTROM_DIFFICULTY: c.LIST_DIFFICULTIES[0] } } response = h.api_post_request( constants.FLASK_BACKEND_URL + constants.API_MISC_BRAINSTORM_GET_EXERCISE_LIST, payload) assert response is not None assert response.status_code == 200 data = response.json()[c.MISC_KEY_EXERCISES][0] assert len(data[c.MISC_KEY_EXERCISE]) == 3 assert data[c.MISC_KEY_SOLUTION] is not None