Example #1
0
 def setUp(self):  # pylint: disable=super-method-not-called
     "setup tests"
     BaseRestProctoringProvider.base_url = 'http://rr.fake'
     self.provider = BaseRestProctoringProvider('client_id',
                                                'client_secret')
     responses.add(responses.POST,
                   url=self.provider.base_url + '/oauth2/access_token',
                   json={
                       'access_token': 'abcd',
                       'expires_in': 600
                   },
                   status=200)
     self.backend_exam = {
         'course_id': 'course123',
         'id': 1,
         'external_id': 'abcdefg',
         'name': 'my exam',
         'is_active': True,
         'is_proctored': True,
         'is_practice': False,
     }
     self.register_exam_context = {
         'attempt_code': '2',
         'obs_user_id': 'abcdefghij',
         'full_name': 'user name',
         'lms_host': 'http://lms.com'
     }
Example #2
0
 def test_create_exam_with_defaults(self):
     provider = BaseRestProctoringProvider(
         default_rules={'allow_grok': True})
     responses.add(responses.POST,
                   url=self.provider.create_exam_url,
                   json={'id': 'abcdefg'})
     self.backend_exam.pop('external_id')
     external_id = provider.on_exam_saved(self.backend_exam)
     request = json.loads(responses.calls[-1].request.body.decode('utf-8'))
     self.assertEqual(external_id, 'abcdefg')
     self.assertTrue(request['rules']['allow_grok'])
Example #3
0
 def setUp(self):
     "setup tests"
     BaseRestProctoringProvider.base_url = 'http://rr.fake'
     self.provider = BaseRestProctoringProvider('client_id', 'client_secret')
     responses.add(
         responses.POST,
         url=self.provider.base_url + '/oauth2/access_token',
         json={'access_token': 'abcd', 'expires_in': 600},
         status=200
     )
     self.backend_exam = {
         'course_id': 'course123',
         'id': 1,
         'external_id': 'abcdefg',
         'name': 'my exam',
         'is_active': True,
         'is_proctored': True,
         'is_practice': False,
     }