def test_it_returns_match(self): action = GetMatchByIdAction() match = MatchFactory.build() request = get_fake_request() action.common = {'match': match} result = json.loads(action.run(request, match_id=match.id).content) expected = { 'match': { 'id': match.id, 'sets_number': match.sets_number, 'access_code': match.access_code, 'status': match.status, 'game_status': match.game_status, 'set_points_number': match.set_points_number, 'points_difference': match.points_difference, 'tie_break_points': match.tie_break_points, 'teams': [], 'sets': [], 'winner_team': match.winner_team, } } assert expected == result
def test_get_minimum_sets_to_play_return_4_when_sets_is_7(self): match = MatchFactory.build(sets_number=7) result = match.get_minimum_sets_to_play() assert result == 4