def test_assignments(self):
     assignments = get_assignments(submissions=get_submissions(),
                                   judge_profiles=get_judge_profiles(),
                                   commit=False)
     self.assertEvenAssignment(assignments)
     # Check nothing has been saved
     self.assertEqual(JudgeAssignment.objects.count(), 0)
 def test_no_assigned_submissions(self):
     """Test assigned submissions aren't included for assignment."""
     alex_profile = User.objects.get(username='******').get_profile()
     submission = Submission.objects.get(title='Submission 2')
     JudgeAssignment.objects.create(submission=submission,
                                    judge=alex_profile)
     self.assertEqual(set(s.title for s in get_submissions()),
                      set(['Submission %d' % n for n in [1, 3, 4, 5]]))
 def test_no_judged_submissions(self):
     """Test judged submissions aren't included for assignment."""
     alex_profile = User.objects.get(username='******').get_profile()
     submission = Submission.objects.get(title='Submission 3')
     Judgement.objects.create(judge=alex_profile, submission=submission,
                              notes='Blah')
     self.assertEqual(set(s.title for s in get_submissions()),
                      set(['Submission %d' % n for n in [1, 2, 4, 5]]))
 def test_assignment_commit(self):
     assignments = get_assignments(submissions=get_submissions(),
                                   judge_profiles=get_judge_profiles(),
                                   commit=True)
     self.assertEvenAssignment(assignments)
     expected_submissions = (settings.JUDGES_PER_SUBMISSION *
                             Submission.objects.count())
     self.assertEqual(JudgeAssignment.objects.count(),
                      expected_submissions)
 def test_no_assigned_judged_submissions(self):
     """Test previously-assigned, judged submissions."""
     alex_profile = User.objects.get(username='******').get_profile()
     submission_a = Submission.objects.get(title='Submission 4')
     submission_b = Submission.objects.get(title='Submission 2')
     Judgement.objects.create(judge=alex_profile, submission=submission_a,
                              notes='Blah')
     JudgeAssignment.objects.create(submission=submission_b,
                                    judge=alex_profile)
     self.assertEqual(set(s.title for s in get_submissions()),
                      set(['Submission %d' % n for n in [1, 3, 5]]))
 def test_no_excluded_submissions(self):
     excluded = Submission.objects.get(title='Submission 3')
     ExclusionFlag.objects.create(submission=excluded)
     
     self.assertEqual(set(s.title for s in get_submissions()),
                      set(['Submission %d' % n for n in [1, 2, 4, 5]]))
 def test_submissions(self):
     self.assertEqual(len(get_submissions()), 5)