def test_json_base64_identity(self):
     self.assertEquals(self._ob, _json_base64_decode(
                       _json_base64_encode(self._ob)))
     self.assertEquals(self._ob_json, _json_base64_encode(
                       _json_base64_decode(self._ob_json)))
     for j in self._jsons:
         self.assertEquals(j, _json_base64_encode(_json_base64_decode(j)))
Esempio n. 2
0
 def test_json_base64_identity(self):
     self.assertEqual(self._ob, self._json_base64_decode(
                       _json_base64_encode(self._ob)))
     self.assertEqual(self._ob_json, _json_base64_encode(
                       self._json_base64_decode(self._ob_json)))
     for j in self._jsons:
         self.assertEqual(j, _json_base64_encode(
                 self._json_base64_decode(j)))
Esempio n. 3
0
    def test_push_grade(self):
        submission = ProgramSubmission.objects.get()
        problem = Problem.objects.get(id=1)
        problem.controller_name = \
                'oioioi.zeus.tests.ZeusProblemController'
        problem.save()
        ZeusProblemController(problem).judge(submission)
        self.assertEqual(SavedEnviron.objects.count(), 1)

        saved_environ = SavedEnviron.objects.get()
        saved_environ_id = saved_environ.id
        signature = zeus_url_signature(saved_environ_id)

        url = reverse('oioioi.zeus.views.push_grade',
                      kwargs={
                          'saved_environ_id': saved_environ_id,
                          'signature': signature
                      })
        data = {u'compilation_output': Base64String("CE")}
        response = self.client.post(url,
                                    _json_base64_encode(data),
                                    follow=True,
                                    content_type="application/json")
        self.assertEqual(response.status_code, 200)
        submission = ProgramSubmission.objects.get()
        self.assertEqual(submission.status, 'CE')
Esempio n. 4
0
    def test_push_grade(self):
        submission = ProgramSubmission.objects.get()
        problem = Problem.objects.get(id=1)
        problem.controller_name = \
                'oioioi.zeus.controllers.ZeusProblemController'
        problem.save()
        ZeusProblemController(problem).judge(submission)
        self.assertEqual(ZeusAsyncJob.objects.count(), 1)

        job = ZeusAsyncJob.objects.get()
        env = json.loads(job.environ)
        check_uid = env['zeus_check_uids']['INITIAL']
        signature = zeus_url_signature(check_uid)

        url = reverse('oioioi.zeus.views.push_grade',
                      kwargs={
                          'check_uid': check_uid,
                          'signature': signature
                      })
        data = {u'compilation_output': Base64String("CE")}
        response = self.client.post(url,
                                    _json_base64_encode(data),
                                    follow=True,
                                    content_type="application/json")
        self.assertEqual(response.status_code, 200)
        submission = ProgramSubmission.objects.get()
        self.assertEqual(submission.status, 'CE')
Esempio n. 5
0
    def test_push_grade(self):
        submission = ProgramSubmission.objects.get()
        problem = Problem.objects.get(id=1)
        problem.controller_name = \
                'oioioi.zeus.tests.ZeusProblemController'
        problem.save()
        ZeusProblemController(problem).judge(submission)
        self.assertEqual(SavedEnviron.objects.count(), 1)

        saved_environ = SavedEnviron.objects.get()
        saved_environ_id = saved_environ.id
        signature = zeus_url_signature(saved_environ_id)

        url = reverse('zeus_push_grade_callback',
                      kwargs={
                        'saved_environ_id': saved_environ_id,
                        'signature': signature})
        data = {u'compilation_output': Base64String("CE")}
        response = self.client.post(url, _json_base64_encode(data),
                follow=True, content_type="application/json")
        self.assertEqual(response.status_code, 200)
        submission = ProgramSubmission.objects.get()
        self.assertEqual(submission.status, 'CE')
 def test_json_base64_encode(self):
     self.assertEquals(_json_base64_encode(self._ob), self._ob_json)
Esempio n. 7
0
 def test_json_base64_encode(self):
     self.assertEqual(_json_base64_encode(self._ob), self._ob_json)