Ejemplo n.º 1
0
class MatchTestSetUp(TestsSetUpBase):
    base_url = reverse('matches-list')
    referee = PersonRepresentation(1, 'referee')
    competition1 = league_competition(1)
    competition2 = tournament_competition(1)
    match1 = MatchRepresentation(30, referee.model, competition1.model)
    match2 = MatchRepresentation(50, referee.model, competition2.model)
    updated_match = MatchRepresentation(30, referee.model, competition2.model)

    def post_nested_to_single(self, person=referee):
        self.register_user()
        self.post_method(reverse('people-list'), person.json)
        self.post_method(reverse('competitions-list'), self.competition1.json)

    def post_nested_to_both(self):
        self.post_nested_to_single()
        self.post_method(reverse('competitions-list'), self.competition2.json)

    def post_single_match(self, person=referee):
        self.post_nested_to_single(person)
        self.post_method(self.base_url, self.match1.json)

    def post_two_matches(self):
        self.post_nested_to_both()
        self.post_method(self.base_url, self.match1.json)
        self.post_method(self.base_url, self.match2.json)

    def get_nth_element_url(self, n):
        return self.get_specific_url(self.base_url, n)
Ejemplo n.º 2
0
 def post_nested_to_single(self):
     self.register_user()
     self.create_goals()
     self.post_method(reverse('teams-list'), team(1).json)
     self.post_method(reverse('players-list'), self.player1.json)
     self.post_method(reverse('people-list'), coach_person(2).json)
     self.post_method(reverse('people-list'), referee_person(3).json)
     self.post_method(reverse('competitions-list'), league_competition(1).json)
     self.post_method(reverse('matches-list'), match(1, referee_person(3)).json)
     self.post_method(reverse('match_teams-list'), self.match_team.json)
class CompetitionTestSetUp(TestsSetUpBase):
    base_url = reverse('competitions-list')
    competition1 = league_competition(1)
    competition2 = tournament_competition(2)
    updated_competition = tournament_competition(1)

    def get_nth_element_url(self, n):
        return self.get_specific_url(self.base_url, n)

    def post_single_competition(self):
        self.register_user()
        self.post_method(self.base_url, self.competition1.json)

    def post_two_competitions(self):
        self.register_user()
        self.post_method(self.base_url, self.competition1.json)
        self.post_method(self.base_url, self.competition2.json)
Ejemplo n.º 4
0
class MatchEventTestSetUp(TestsSetUpBase):
    base_url = reverse('match_events-list')
    referee = referee_person(1)
    competition = league_competition(1)
    match1 = match(1)
    match2 = match(2)

    def create_events(self):
        self.register_user(2)
        self.event_info1 = event_info(1, self.get_user_model(2))
        self.event_info2 = event_info(2, self.get_user_model(2))
        self.match_event1 = MatchEventRepresentation(1, self.match1.model, self.event_info1.model)
        self.match_event2 = MatchEventRepresentation(2, self.match1.model, self.event_info2.model)
        self.updated_match_event = MatchEventRepresentation(1, self.match2.model, self.event_info1.model)

    def post_nested_to_single(self):
        self.register_user()
        self.create_events()
        self.post_method(reverse('people-list'), self.referee.json)
        self.post_method(reverse('competitions-list'), self.competition.json)
        self.post_method(reverse('matches-list'), self.match1.json)
        
    def post_nested_to_both(self):
        self.register_user()
        self.post_nested_to_single()

    def post_single_match(self):
        self.post_nested_to_single()
        self.post_method(self.base_url, self.match_event1.json)

    def post_two_matches(self):
        self.post_nested_to_both()
        self.post_method(self.base_url, self.match_event1.json)
        self.post_method(self.base_url, self.match_event2.json)

    def get_nth_element_url(self, n):
        return self.get_specific_url(self.base_url, n)