Skip to content

Commit

Permalink
test: [AXIMST-676] fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NiedielnitsevIvan committed Mar 20, 2024
1 parent 40ca077 commit 0af632a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lms/djangoapps/course_home_api/outline/tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ def test_get_unknown_course(self):
assert response.status_code == 404

@patch.dict('django.conf.settings.FEATURES', {'ENABLE_SPECIAL_EXAMS': True})
def test_proctored_exam(self):
@patch('lms.djangoapps.course_api.blocks.transformers.milestones.get_attempt_status_summary')
def test_proctored_exam(self, mock_summary):
"""
Test that the API returns the correct data for a proctored exam.
"""
Expand Down Expand Up @@ -596,6 +597,10 @@ def test_proctored_exam(self):
sequence.is_proctored_exam = True
update_outline_from_modulestore(course.id)
CourseEnrollment.enroll(self.user, course.id)
mock_summary.return_value = {
'short_description': 'My Exam',
'suggested_icon': 'fa-foo-bar',
}

url = reverse('course-home:course-sidebar-blocks', args=[course.id])
response = self.client.get(url)
Expand All @@ -604,6 +609,7 @@ def test_proctored_exam(self):
exam_data = response.data['blocks'][str(sequence.location)]
assert not exam_data['complete']
assert exam_data['display_name'] == 'Test Proctored Exam'
assert exam_data['special_exam_info'] == 'My Exam'
assert exam_data['due'] is not None

def test_assignment(self):
Expand All @@ -618,12 +624,12 @@ def test_assignment(self):

exam_data = response.data['blocks'][str(self.sequential.location)]
assert exam_data['display_name'] == 'Test (1 Question)'
assert exam_data['icon'] == 'fa-pencil-square-o'
assert exam_data['icon'] == 'lock'
assert str(self.vertical.location) in exam_data['children']

ungraded_data = response.data['blocks'][str(self.ungraded_sequential.location)]
assert ungraded_data['display_name'] == 'Ungraded'
assert ungraded_data['icon'] is None
assert ungraded_data['icon'] == 'lock'
assert str(self.ungraded_vertical.location) in ungraded_data['children']

@override_waffle_flag(COURSE_ENABLE_UNENROLLED_ACCESS_FLAG, active=True)
Expand Down

0 comments on commit 0af632a

Please sign in to comment.