Commit 281b1b0e by Muhammad Shoaib

test cases tweaks

parent be001340
...@@ -87,7 +87,7 @@ def update_exam(exam_id, exam_name=None, time_limit_mins=None, ...@@ -87,7 +87,7 @@ def update_exam(exam_id, exam_name=None, time_limit_mins=None,
if is_proctored is not None: if is_proctored is not None:
proctored_exam.is_proctored = is_proctored proctored_exam.is_proctored = is_proctored
if is_practice_exam is not None: if is_practice_exam is not None:
proctored_exam.is_practice_exam=is_practice_exam, proctored_exam.is_practice_exam = is_practice_exam
if external_id is not None: if external_id is not None:
proctored_exam.external_id = external_id proctored_exam.external_id = external_id
if is_active is not None: if is_active is not None:
......
...@@ -121,7 +121,7 @@ class ProctoredExamStudentAttemptManager(models.Manager): ...@@ -121,7 +121,7 @@ class ProctoredExamStudentAttemptManager(models.Manager):
Returns the Student Exam Attempts for the given course_id. Returns the Student Exam Attempts for the given course_id.
""" """
return self.filter(proctored_exam__course_id=course_id) return self.filter(proctored_exam__course_id=course_id).order_by('-created')
def get_filtered_exam_attempts(self, course_id, search_by): def get_filtered_exam_attempts(self, course_id, search_by):
""" """
......
...@@ -29,6 +29,7 @@ class ProctoredExamSerializer(serializers.ModelSerializer): ...@@ -29,6 +29,7 @@ class ProctoredExamSerializer(serializers.ModelSerializer):
time_limit_mins = serializers.IntegerField(required=True) time_limit_mins = serializers.IntegerField(required=True)
is_active = StrictBooleanField(required=True) is_active = StrictBooleanField(required=True)
is_practice_exam = StrictBooleanField(required=False)
is_proctored = StrictBooleanField(required=True) is_proctored = StrictBooleanField(required=True)
class Meta: class Meta:
...@@ -39,7 +40,7 @@ class ProctoredExamSerializer(serializers.ModelSerializer): ...@@ -39,7 +40,7 @@ class ProctoredExamSerializer(serializers.ModelSerializer):
fields = ( fields = (
"id", "course_id", "content_id", "external_id", "exam_name", "id", "course_id", "content_id", "external_id", "exam_name",
"time_limit_mins", "is_proctored", "is_active" "time_limit_mins", "is_proctored", "is_practice_exam", "is_active"
) )
......
...@@ -473,8 +473,8 @@ class ProctoredExamApiTests(LoggedInTestCase): ...@@ -473,8 +473,8 @@ class ProctoredExamApiTests(LoggedInTestCase):
) )
filtered_attempts = get_filtered_exam_attempts(self.course_id, self.user.username) filtered_attempts = get_filtered_exam_attempts(self.course_id, self.user.username)
self.assertEqual(len(filtered_attempts), 2) self.assertEqual(len(filtered_attempts), 2)
self.assertEqual(filtered_attempts[0]['id'], exam_attempt.id) self.assertEqual(filtered_attempts[0]['id'], new_exam_attempt)
self.assertEqual(filtered_attempts[1]['id'], new_exam_attempt) self.assertEqual(filtered_attempts[1]['id'], exam_attempt.id)
def test_get_all_exam_attempts(self): def test_get_all_exam_attempts(self):
""" """
...@@ -493,8 +493,8 @@ class ProctoredExamApiTests(LoggedInTestCase): ...@@ -493,8 +493,8 @@ class ProctoredExamApiTests(LoggedInTestCase):
) )
all_exams = get_all_exam_attempts(self.course_id) all_exams = get_all_exam_attempts(self.course_id)
self.assertEqual(len(all_exams), 2) self.assertEqual(len(all_exams), 2)
self.assertEqual(all_exams[0]['id'], exam_attempt.id) self.assertEqual(all_exams[0]['id'], updated_exam_attempt_id)
self.assertEqual(all_exams[1]['id'], updated_exam_attempt_id) self.assertEqual(all_exams[1]['id'], exam_attempt.id)
def test_get_student_view(self): def test_get_student_view(self):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment