def test_index(expectedroutes): """Test the index returns all availables routes""" url = helpertest.apirooturl() + "/index" response = requests.get(url) assert response.status_code == 200 routes = response.json() assert expectedroutes == routes
def test_list_edition(): """Test that Editions return a list of edition object""" url = helpertest.apirooturl() + "/Editions" response = requests.get(url) assert response.status_code == 200 editions = response.json() assert editions for edition in editions: check_edition(edition)
def test_version(): """Test that version returns a version object""" url = helpertest.apirooturl() + "/version" response = requests.get(url) assert response.status_code == 200 version = response.json() versionvalue = version.get("version") assert versionvalue is not None assert versionvalue.startswith("1.")
def test_ranking_by_touchdown(): """ Test that ranking/coach/td/<edition> returns an array of coach and the first one has most td""" url = helpertest.apirooturl() + "/ranking/coach/td/1" _test_ranking_element_by_property(url, check_rank, "tdFor")
def test_main_ranking(): """ Test that ranking/coach/main/<edition> returns an array of coach and that first coach is coach_29""" url = helpertest.apirooturl() + "/ranking/coach/main/1" _test_ranking_elt(url, "coach_29", check_rank)
def test_team_ranking_by_defense(): """ Test that ranking/coachTeam/defense/<edition> returns an array of team ranking and the first one has least td against """ url = helpertest.apirooturl() + "/ranking/coachTeam/defense/1" _test_ranking_element_by_defense(url, check_team_rank)
def test_team_ranking_by_comeback(): """ Test that ranking/coachTeam/comeback/<edition> returns an array of team ranking and the first one has most win ranks""" url = helpertest.apirooturl() + "/ranking/coachTeam/comeback/1" _test_ranking_element_by_property(url, check_team_rank, "diffRanking")
def test_list_coach_team(): """Test that CoachTeams/<edition> returns a list of coach_team object""" url = helpertest.apirooturl() + "/CoachTeams/" + helpertest.edition() helpertest.check_dict_element(url, check_coach_team)
def test_to_play_matchs_empty(): """Test that ToPlayMatchs/<edition>/<round> returns a list of match object""" url = helpertest.apirooturl() + "/ToPlayMatchs/1/1" helpertest.check_empty_list(url)
def test_to_play_matchs(): """Test that ToPlayMatchs/<edition>/<round> returns a list of match object""" url = helpertest.apirooturl() + "/ToPlayMatchs/1/5" helpertest.check_list_element(url, assert_to_play_match_edition_1_round_5)
def test_played_matchs(): """Test that PlayedMatchs/<edition>/<round> returns a list of match object""" url = helpertest.apirooturl() + "/PlayedMatchs/1/1" helpertest.check_list_element(url, assert_played_match_edition_1_round_1)
def test_get_coach(): """Test that Coach/<id> returns a coach object""" url = helpertest.apirooturl() + "/Coach/1" helpertest.check_element(url, check_coach)
def test_team_ranking_by_completions(): """ Test that ranking/coachTeam/completions/<edition> returns an array of team ranking and the first one has most completions""" url = helpertest.apirooturl( ) + "/ranking/coachTeam/completions/" + helpertest.edition() _test_ranking_element_by_property(url, check_team_rank, "completionsFor")
def test_list_match(): """Test that Matchs/<edition>/<round> returns a list of match object""" url = helpertest.apirooturl() + "/Matchs/" + helpertest.edition() + "/1" helpertest.check_list_element(url, assert_match_edition_1_round_1)
def test_ranking_by_casualties(): """ Test that ranking/coach/casualties/<edition> returns an array of coach and the first one has most casualties""" url = helpertest.apirooturl() + "/ranking/coach/casualties/1" _test_ranking_element_by_property(url, check_rank, "casualtiesFor")
def test_get_matchs_by_coach_team(): """Test that MatchsByCoach/<coachid> returns a list of match object""" url = helpertest.apirooturl() + "/MatchsByCoachTeam/1" helpertest.check_list_element(url, assert_match)
def test_current_edition(): """Test that Edition/current return an edition object""" url = helpertest.apirooturl() + "/Edition/current" helpertest.check_element(url, check_edition)
def test_team_ranking(): """ Test that ranking/coachTeam/main/<edition> returns an array of coach_team and that first coach_team is coach_team_8""" url = helpertest.apirooturl() + "/ranking/coachTeam/main/1" _test_ranking_elt(url, "coach_team_8", check_team_rank)
def test_edition_one(): """Test that Edition/1 return an edition object""" url = helpertest.apirooturl() + "/Edition/" + helpertest.edition() helpertest.check_element(url, check_edition)
def test_team_ranking_by_fouls(): """ Test that ranking/coachTeam/fouls/<edition> returns an array of team ranking and the first one has most fouls""" url = helpertest.apirooturl() + "/ranking/coachTeam/fouls/1" _test_ranking_element_by_property(url, check_team_rank, "foulsFor")
def test_coach_team(): """Test that CoachTeam/<id> returns a coach_team object""" url = helpertest.apirooturl() + "/CoachTeam/1" helpertest.check_element(url, check_coach_team)
def test_get_coach_list(): """Test that Coachs/<edition> returns a list of coach object""" url = helpertest.apirooturl() + "/Coachs/1" helpertest.check_dict_element(url, check_coach)