示例#1
0
 def test_create_courseref_only_lti(self, mocked):
     """
     Test that only LTI is allowed.
     """
     request = Mock()
     request.session = {}
     res = create_courseref(request)
     self.assertEqual(res.content, 'Only LTI allowed')
示例#2
0
 def test_create_courseref_only_lti(self, mocked):
     """
     Test that only LTI is allowed.
     """
     request = Mock()
     request.session = {}
     res = create_courseref(request)
     self.assertEqual(res.content, 'Only LTI allowed')
示例#3
0
 def test_create_courseref_existence(self, context_id, langing_page, mocked):
     """
     Test for existence/non-existence of CourseRef.
     """
     _id = self.course.id if context_id == '1' else self.course.id + 1
     lti_post = {'context_id': context_id,
                 'context_title': 'test title',
                 'tool_consumer_instance_guid': 'test.dot.com',
                 'roles': 'Instructor'}
     request = Mock()
     request.user = self.user
     request.session = {'LTI_POST': lti_post,
                        'is_valid': True}
     res = create_courseref(request)
     self.assertEqual(res.url, reverse(langing_page, args=(_id,)))
示例#4
0
 def test_create_courseref_existence(self, context_id, langing_page,
                                     mocked):
     """
     Test for existence/non-existence of CourseRef.
     """
     _id = self.course.id if context_id == '1' else self.course.id + 1
     lti_post = {
         'context_id': context_id,
         'context_title': 'test title',
         'tool_consumer_instance_guid': 'test.dot.com',
         'roles': 'Instructor'
     }
     request = Mock()
     request.user = self.user
     request.session = {'LTI_POST': lti_post, 'is_valid': True}
     res = create_courseref(request)
     self.assertEqual(res.url, reverse(langing_page, args=(_id, )))