Beispiel #1
0
    def test_bad_status(self):
        """
        Try passing a bad status
        """

        with self.assertRaises(Exception):
            set_attempt_status.Command().handle(exam_id=self.exam_id,
                                                user_id=self.user.id,
                                                to_status='bad')
Beispiel #2
0
    def test_run_comand(self):
        """
        Run the management command
        """

        set_attempt_status.Command().handle(
            exam_id=self.exam_id,
            user_id=self.user.id,
            to_status=ProctoredExamStudentAttemptStatus.rejected)

        attempt = get_exam_attempt(self.exam_id, self.user.id)
        self.assertEqual(attempt['status'],
                         ProctoredExamStudentAttemptStatus.rejected)

        set_attempt_status.Command().handle(
            exam_id=self.exam_id,
            user_id=self.user.id,
            to_status=ProctoredExamStudentAttemptStatus.verified)

        attempt = get_exam_attempt(self.exam_id, self.user.id)
        self.assertEqual(attempt['status'],
                         ProctoredExamStudentAttemptStatus.verified)