示例#1
0
    def test_api_get_request(self):
        resp = h.api_get_request(c.FLASK_BACKEND_URL + c.API_HEALTH_CHECK)
        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
    def test_misc_get_constants(self):
        response = h.api_get_request(constants.FLASK_BACKEND_URL +
                                     constants.API_MISC_GET_CONSTANTS)

        assert response is not None
        assert response.status_code == 200

        data = response.json()[c.MISC_KEY_MISC_CONSTANTS][0]
        assert data[c.MISC_KEY_LIST_MATH_SYMBOLS] == c.LIST_MATH_SYMBOLS
        assert data[c.MISC_KEY_LIST_DIFFICULTIES] == c.LIST_DIFFICULTIES
    def test_eso_get_constants(self):
        response = h.api_get_request(constants.FLASK_BACKEND_URL +
                                     constants.API_ESO_GET_CONSTANTS)

        assert response is not None
        assert response.status_code == 200

        data = response.json()[c.ESO_KEY_ESO_CONSTANTS][0]
        assert data[c.ESO_KEY_LIST_ESO_CLASSES] == c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_LIST_ESO_DUNGEONS] == c.LIST_ESO_DUNGEONS
        assert data[c.ESO_KEY_LIST_ESO_RAIDS] == c.LIST_ESO_RAIDS
示例#4
0
    def test_survrun_query_get_runs(self):
        """
        Test survrun get all data query. This tests fails if the survrun_runs table is empty.
        """
        response = h.api_get_request(constants.FLASK_BACKEND_URL + constants.API_SURVRUN_GET_ALL_DB_RUN_DATA)
        data = json.loads(response.content)["queryResult"][0]

        assert response is not None
        assert response.status_code == 200
        assert type(data[c.SR_KEY_ID]) == int
        assert data[c.SR_KEY_PLAYER_CLASS] in c.LIST_SURVRIM_CLASSES
        assert data[c.SR_KEY_TARGET_A] in c.LIST_SURVRUN_TARGET_LOCATIONS
        assert data[c.SR_KEY_TARGET_B] in c.LIST_SURVRUN_TARGET_LOCATIONS
        assert type(data[c.SR_KEY_TIMEBOX]) == int
        assert data[c.SR_KEY_COMPLETED] == c.SURVRIM_YES or data[c.SR_KEY_COMPLETED] == c.SURVRIM_NO
        assert type(data[c.SR_KEY_TIME_NEEDED]) == int
        assert type(data[c.SR_KEY_R_COUNT]) == int
示例#5
0
    def test_get_target_location_data(self):
        response = h.api_get_request(constants.FLASK_BACKEND_URL + constants.API_SURVRUN_GET_TARGET_LOCATION)

        assert response is not None
        assert response.status_code == 200

        unique_locations_in_response = 0
        for location in c.LIST_SURVRUN_TARGET_LOCATIONS:
            if unique_locations_in_response == 2:
                break
            if location in response.text:
                unique_locations_in_response += 1
        assert unique_locations_in_response == 2

        data = json.loads(response.text)
        assert type(data[c.SR_KEY_SURVRUN_DATA][0][c.SR_KEY_TARGET_LOCATION_ONE]) == str
        assert type(data[c.SR_KEY_SURVRUN_DATA][0][c.SR_KEY_TARGET_LOCATION_TWO]) == str
        assert data[c.SR_KEY_SURVRUN_DATA][0][c.SR_KEY_TIMEBOX] is not None
        assert type(data[c.SR_KEY_SURVRUN_DATA][0][c.SR_KEY_TIMEBOX]) == int
    def test_eso_query_get_dungeon_runs(self):
        """
        Test eso get dungeon runs endpoint
        Note that this test will always fail if the database is empty!
        """
        response = h.api_get_request(constants.FLASK_BACKEND_URL +
                                     constants.API_ESO_GET_DUNGEON_RUNS)

        assert response is not None
        assert response.status_code == 200

        data = response.json()[c.ESO_KEY_QUERY_RESULT][0]
        assert type(data[c.ESO_KEY_ID]) == int
        assert data[c.ESO_KEY_DUNGEON_NAME] in c.LIST_ESO_DUNGEONS
        assert type(data[c.ESO_KEY_PLAYER_COUNT]) == int
        assert type(data[c.ESO_KEY_TIME_NEEDED]) == int
        assert type(data[c.ESO_KEY_HARDMODE]) == bool
        assert type(data[c.ESO_KEY_FLAWLESS]) == bool
        assert type(data[c.ESO_KEY_WIPES]) == int
        assert data[c.ESO_KEY_CLASS_ONE] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_TWO] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_THREE] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_FOUR] in c.LIST_ESO_CLASSES
    def test_eso_query_get_raid_runs(self):
        """
        Test eso get raid runs endpoint
        Note that this test will always fail if the database is empty!
        """
        response = h.api_get_request(constants.FLASK_BACKEND_URL +
                                     constants.API_ESO_GET_RAID_RUNS)

        assert response is not None
        assert response.status_code == 200

        data = response.json()[c.ESO_KEY_QUERY_RESULT][0]
        assert type(data[c.ESO_KEY_ID]) == int
        assert data[c.ESO_KEY_RAID_NAME] in c.LIST_ESO_RAIDS
        assert type(data[c.ESO_KEY_PLAYER_COUNT]) == int
        assert type(data[c.ESO_KEY_TIME_NEEDED]) == int
        assert type(data[c.ESO_KEY_HARDMODE]) == bool
        assert type(data[c.ESO_KEY_FLAWLESS]) == bool
        assert type(data[c.ESO_KEY_WIPES]) == int
        assert data[c.ESO_KEY_CLASS_ONE] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_TWO] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_THREE] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_FOUR] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_FIVE] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_SIX] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_SEVEN] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_EIGHT] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_NINE] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_TEN] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_ELEVEN] in c.LIST_ESO_CLASSES
        assert data[c.ESO_KEY_CLASS_TWELVE] in c.LIST_ESO_CLASSES
        assert type(data[c.ESO_KEY_NUM_TANKS]) == int
        assert type(data[c.ESO_KEY_NUM_DPS]) == int
        assert type(data[c.ESO_KEY_NUM_HEALS]) == int
        assert type(data[c.ESO_KEY_TOTAL_PARTY_DPS]) == int
        assert type(data[c.ESO_KEY_TOTAL_PARTY_HPS]) == int
示例#8
0
    def test_survrun_get_constants(self):
        response = h.api_get_request(constants.FLASK_BACKEND_URL + constants.API_SURVRUN_GET_CONSTANTS)
        data = json.loads(response.content)[c.SR_KEY_SURVRIM_CONSTANTS][0]

        assert response.status_code == 200
        assert data is not None