def test_add_result_bye_victory(self): competition = PreAddedCompetitionOfSize(entries__num_of_entries=7) stage = competition.stage_set.create(state=Stage.STARTED, type=Stage.DE, number=1) de_stage = stage.destage_set.first() de_stage.start() table_head = de_stage.detable_set.first() manager = ManagerFactory(organisation=competition.organisation).user target = reverse('main/de_table_endpoint', kwargs={'table_id': table_head.id}) self.c.force_login(manager) eA = table_head.detableentry_set.first() eB = eA.against() out = self.c.post( target, { 'type': 'add_result', 'entryA': eA.id, 'entryB': eB.id, 'scoreA': 0, 'scoreB': 15, 'victoryA': 0 }) self.assertJSONEqual( out.content, { 'success': False, 'reason': 'bye_victory', 'verbose_reason': 'Byes cannot win a match' }) eA.refresh_from_db() eB.refresh_from_db() self.assertEqual(eA.score, 0) self.assertEqual(eA.victory, True) self.assertEqual(eB.score, 0) self.assertEqual(eB.victory, False)
def setUp(self): self.c = Client() self.competition = PreAddedCompetitionOfSize(entries__num_of_entries=8) self.org = self.competition.organisation self.manager = ManagerFactory(organisation=self.org).user self.dt = DTFactory(organisation=self.org).user self.applicant = OrgMemberFactory(organisation=self.org).user org = OrganisationFactory() self.wrong_org_manager = ManagerFactory(organisation=org).user
def setUp(self): self.comp = PreAddedCompetitionOfSize( entries__num_of_entries=8) # type: Competition self.organisation = self.comp.organisation # type: Organisation self.manager = ManagerFactory(organisation=self.organisation).user self.stage = self.comp.stage_set.create(type=Stage.DE, number=1, state=Stage.NOT_STARTED) self.target = reverse( 'ui/manage_stage', args=[self.organisation.slug, self.comp.id, self.stage.id])
def setUp(self): self.c = Client() self.competition = PreAddedCompetitionOfSize(entries__num_of_entries=8) self.stage = self.competition.stage_set.create(state=Stage.STARTED, type=Stage.DE, number=1) self.de_stage = self.stage.destage_set.first() self.de_stage.start() self.table_head = self.de_stage.detable_set.first() self.manager = ManagerFactory( organisation=self.competition.organisation).user org = OrganisationFactory() self.wrong_org_manager = ManagerFactory(organisation=org).user self.target = reverse('main/de_table_endpoint', kwargs={'table_id': self.table_head.id})
def setUp(self): self.competition = PreAddedCompetitionOfSize( entries__num_of_entries=10) self.manager = ManagerFactory( organisation=self.competition.organisation).user