def testRaisesExceptionForNotEnoughVenues(self): generate_objects.valid_venue() for i in range(0, 20): debate = generate_objects.valid_debate() debate.save() controller = VenueMapper() with self.assertRaises(TournamentStateException): controller.map_venues(1)
def testEachDebateHasVenue(self): for i in range(0, 12): venue = generate_objects.valid_venue() venue.save() debate = generate_objects.valid_debate() debate.save() controller = VenueMapper() controller.map_venues(1) for debate in Debate.objects.all().filter(round=1): self.assertIsNotNone(debate.venue)
def draw_next_round(self): tournament = Tournament.instance() next_round = tournament.round + 1 pools = self.create_pools(Team.objects.all(), tournament.round) pools = self.remove_empty(pools) pools = self.shuffle_pools(pools) pools = self.balance_pools(pools) debates = self.draw_from_pools(next_round, pools) tournament.round = next_round tournament.save() mapper = VenueMapper() mapper.map_venues(next_round) return debates
def post(self, request): controller = InitialDrawController() controller.initial_draw() mapper = VenueMapper() mapper.map_venues(1) return redirect('/draw')