Exemple #1
0
    def test_submission_location(self):
        Submission.objects.all().delete()
        test_sub = test_util.get_sub("IN", STUDENT_ID, LOCATION)
        test_sub.save()

        test_sub2 = test_util.get_sub("IN", STUDENT_ID, LOCATION)
        test_sub2.state = SubmissionState.finished
        test_sub2.previous_grader_type = "IN"
        test_sub2.save()

        sl = StaffLocation(LOCATION)
        self.assertEqual(sl.location_submissions().count(), 2)
        self.assertEqual(sl.all_pending_count(), 1)
        self.assertEqual(sl.graded_count(), 1)
        self.assertEqual(sl.pending_count(), 1)
        self.assertEqual(len(sl.graded_submission_text()), 1)
        test_sub2.delete()
        next_item_id = sl.item_to_score()[1]
        self.assertEqual(next_item_id, test_sub.id)

        test_sub = Submission.objects.get(id=next_item_id)
        self.assertEqual(test_sub.state, SubmissionState.being_graded)
        test_sub.state = SubmissionState.waiting_to_be_graded
        test_sub.save()
        self.assertEqual(sl.next_item()[1], test_sub.id)
Exemple #2
0
    def test_submission_location_rescore(self):
        Submission.objects.all().delete()
        test_sub = test_util.get_sub("IN", STUDENT_ID, LOCATION)
        test_sub.save()

        test_grader = test_util.get_grader("BC")
        test_grader.submission = test_sub
        test_grader.save()

        test_grader = test_util.get_grader("ML")
        test_grader.submission = test_sub
        test_grader.save()

        sl = StaffLocation(LOCATION)

        rescore = sl.item_to_rescore()[1]

        self.assertEqual(rescore, test_sub.id)
Exemple #3
0
    def test_get_problem_name(self):
        """
        Test to see if the correct problem name is returned by a location capsule.
        Saves two submissions, and tests to see if the problem name is updated.
        """
        problem_id_one = "Problem One"
        problem_id_two = "Problem Two"

        test_sub = test_util.get_sub("IN", STUDENT_ID, LOCATION)
        test_sub.problem_id = problem_id_one
        test_sub.save()

        sl = StaffLocation(LOCATION)
        self.assertEqual(sl.problem_name(), problem_id_one)

        test_sub2 = test_util.get_sub("IN", STUDENT_ID, LOCATION)
        test_sub2.problem_id = problem_id_two
        test_sub2.save()

        self.assertEqual(sl.problem_name(), problem_id_two)