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'])
 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={})
 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')
 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')
Exemple #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')
 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'])
Exemple #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'])
Exemple #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={})
Exemple #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'])
Exemple #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')
 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)
 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')
Exemple #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)
Exemple #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')