def test_by_lead(self): obj = self.base_factory() # Create an additional round which will create a new staff lead round_other_lead = RoundFactory() qs_all = RoundsAndLabs.objects.with_progress() qs_by_lead = qs_all.by_lead(obj.lead) fetched_obj = qs_by_lead.first() self.assertEqual(qs_all.count(), 2) self.assertEqual(qs_by_lead.count(), 1) self.assertEqual(fetched_obj.lead, obj.lead.full_name) self.assertNotEqual(round_other_lead.title, fetched_obj.title)
def test_doesnt_confuse_lab_and_round(self): round = RoundFactory() lab = LabFactory() # Lab 50% progress LabSubmissionFactory(page=lab) LabSubmissionFactory(page=lab, rejected=True) # Round 0% progress ApplicationSubmissionFactory.create_batch(2, round=round) fetched_lab = RoundsAndLabs.objects.with_progress().last() fetched_round = RoundsAndLabs.objects.with_progress().first() self.assertEqual([fetched_round, fetched_lab], [round, lab]) self.assertEqual(fetched_round.progress, 0) self.assertEqual(fetched_lab.progress, 50)
def test_cant_access_normal_page(self): new_round = RoundFactory() page = new_round.get_site().root_page response = self.get_page(page) self.assertEqual(response.status_code, 403)
def test_cant_access_round_page(self): new_round = RoundFactory() response = self.get_page(new_round) self.assertEqual(response.status_code, 403)
def test_can_access_round_page(self): new_round = RoundFactory() response = self.get_page(new_round) self.assertContains(response, new_round.title)