예제 #1
0
 def test_get_module(self):
     """
     Verify that get_module_by_usage_id is called with the right parameters
     """
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.module_mock.assert_called_with(request, ALL_PARAMS['course_id'], ALL_PARAMS['usage_id'])
예제 #2
0
 def test_render(self):
     """
     Verify that render is called on the right object with the right parameters
     """
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.module_instance.render.assert_called_with('student_view', context={})
예제 #3
0
 def test_course_with_access(self):
     """
     Verify that get_course_with_access is called with the right parameters
     """
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.course_mock.assert_called_with(request.user, 'load', 'CourseKey')
예제 #4
0
 def test_has_access(self):
     """
     Verify that has_access is called with the right parameters
     """
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.access_mock.assert_called_with(request.user, 'staff', 'CourseWithAccess')
예제 #5
0
 def test_course_with_access(self):
     """
     Verify that get_course_with_access is called with the right parameters
     """
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.course_mock.assert_called_with(request.user, 'load', 'CourseKey')
예제 #6
0
 def test_course_key(self):
     """
     Verify that the correct course key is requested
     """
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.key_mock.assert_called_with(ALL_PARAMS['course_id'])
예제 #7
0
 def test_course_key(self):
     """
     Verify that the correct course key is requested
     """
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.key_mock.assert_called_with(ALL_PARAMS['course_id'])
예제 #8
0
 def test_render(self):
     """
     Verify that render is called on the right object with the right parameters
     """
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.module_instance.render.assert_called_with('student_view',
                                                    context={})
예제 #9
0
 def test_get_module(self):
     """
     Verify that get_module_by_usage_id is called with the right parameters
     """
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.module_mock.assert_called_with(request, ALL_PARAMS['course_id'],
                                         ALL_PARAMS['usage_id'])
예제 #10
0
 def test_has_access(self):
     """
     Verify that has_access is called with the right parameters
     """
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.access_mock.assert_called_with(request.user, 'staff',
                                         'CourseWithAccess')
예제 #11
0
 def test_context(self):
     expected_context = {
         'fragment': 'Fragment',
         'course': 'CourseWithAccess',
         'disable_accordion': True,
         'allow_iframing': True,
         'disable_header': True,
         'disable_footer': True,
         'disable_tabs': True,
         'staff_access': 'StaffAccess',
         'xqa_server': 'http://example.com/xqa',
     }
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.render_mock.assert_called_with('courseware/courseware.html', expected_context)
예제 #12
0
 def test_valid_launch(self):
     """
     Verify that the method renders a response when launched correctly
     """
     request = build_run_request()
     response = views.render_courseware(request, ALL_PARAMS.copy())
     self.assertEqual(response, 'Rendered page')
예제 #13
0
 def test_context(self):
     expected_context = {
         'fragment': 'Fragment',
         'course': 'CourseWithAccess',
         'disable_accordion': True,
         'allow_iframing': True,
         'disable_header': True,
         'disable_footer': True,
         'disable_tabs': True,
         'staff_access': 'StaffAccess',
         'xqa_server': 'http://example.com/xqa',
     }
     request = build_run_request()
     views.render_courseware(request, ALL_PARAMS.copy())
     self.render_mock.assert_called_with('courseware/courseware.html',
                                         expected_context)
예제 #14
0
 def test_valid_launch(self):
     """
     Verify that the method renders a response when launched correctly
     """
     request = build_run_request()
     response = views.render_courseware(request, ALL_PARAMS.copy())
     self.assertEqual(response, 'Rendered page')