Пример #1
0
    def add_ungraded_sub(self, rubric_xml, text):
        grader_payload = {
            'location': self.location,
            'course_id': u'MITx/6.002x',
            'problem_id': u'6.002x/Welcome/OETest',
            'grader': "temp",
            'prompt' : 'This is a prompt',
            'rubric' : rubric_xml,
            'grader_settings' : "ml_grading.conf",
            'skip_basic_checks': False
        }
        xqueue_body = {
            'grader_payload': json.dumps(grader_payload),
            'student_info': test_util.get_student_info('test_student'),
            'student_response': text,
            'max_score': 1,
            }
        content = {
            'xqueue_header': test_util.get_xqueue_header(),
            'xqueue_body': json.dumps(xqueue_body),
            }

        self.c.post(
            SUBMIT_URL,
            content,
            )

        sub = Submission.objects.filter(location=self.location).order_by("-date_created")[0]
        return sub
Пример #2
0
    def _message_submission(self, success, score=None, submission_id=None):
        sub = test_util.get_sub("IN", STUDENT_ID, LOCATION)
        sub.save()
        grade = test_util.get_grader("IN")
        grade.submission = sub
        grade.save()
        grader_id = grade.grader_id
        if submission_id is None:
            submission_id = sub.id

        message = {
            'grader_id': grader_id,
            'submission_id': submission_id,
            'feedback': "This is test feedback",
            'student_info': test_util.get_student_info(STUDENT_ID),
        }
        if score is not None:
            message['score'] = score

        content = {
            'xqueue_header': test_util.get_xqueue_header(),
            'xqueue_body': json.dumps(message),
        }
        content = self.c.post(SUBMIT_MESSAGE_URL, content)
        body = json.loads(content.content)
        self.assertEqual(body['success'], success)
Пример #3
0
    def _message_submission(self, success, score=None, submission_id=None):
        sub = test_util.get_sub("IN",STUDENT_ID,LOCATION)
        sub.save()
        grade=test_util.get_grader("IN")
        grade.submission=sub
        grade.save()
        grader_id = grade.grader_id
        if submission_id is None:
            submission_id = sub.id

        message = {
            'grader_id': grader_id,
            'submission_id': submission_id,
            'feedback': "This is test feedback",
            'student_info': test_util.get_student_info(STUDENT_ID),
        }
        if score is not None:
            message['score'] = score
        
        content = {
            'xqueue_header': test_util.get_xqueue_header(),
            'xqueue_body': json.dumps(message),
        }
        content = self.c.post(
                SUBMIT_MESSAGE_URL,
                content
        )
        body = json.loads(content.content)
        self.assertEqual(body['success'], success)
Пример #4
0
    def test_xqueue_submit(self):
        grader_payload = {
            'location': LOCATION,
            'course_id': u'MITx/6.002x',
            'problem_id': u'6.002x/Welcome/OETest',
            'grader': "temp",
            'prompt' : 'This is a prompt',
            'rubric' : 'This is a rubric.',
            'grader_settings' : "ml_grading.conf",
            'skip_basic_checks': False
        }
        xqueue_body = {
            'grader_payload': json.dumps(grader_payload),
            'student_info': test_util.get_student_info(STUDENT_ID),
            'student_response': "Test! And longer now so tests pass.",
            'max_score': 1,
        }
        content = {
            'xqueue_header': test_util.get_xqueue_header(),
            'xqueue_body': json.dumps(xqueue_body),
        }

        response = self.c.login(username='******', password='******')

        content = self.c.post(
            SUBMIT_URL,
            content,
        )

        log.debug(content)

        body = json.loads(content.content)

        self.assertEqual(body['success'], True)
Пример #5
0
    def add_ungraded_sub(self, rubric_xml, text):
        grader_payload = {
            'location': self.location,
            'course_id': u'MITx/6.002x',
            'problem_id': u'6.002x/Welcome/OETest',
            'grader': "temp",
            'prompt': 'This is a prompt',
            'rubric': rubric_xml,
            'grader_settings': "ml_grading.conf",
            'skip_basic_checks': False
        }
        xqueue_body = {
            'grader_payload': json.dumps(grader_payload),
            'student_info': test_util.get_student_info('test_student'),
            'student_response': text,
            'max_score': 1,
        }
        content = {
            'xqueue_header': test_util.get_xqueue_header(),
            'xqueue_body': json.dumps(xqueue_body),
        }

        self.c.post(
            SUBMIT_URL,
            content,
        )

        sub = Submission.objects.filter(
            location=self.location).order_by("-date_created")[0]
        return sub
Пример #6
0
 def get_content(self, grader_payload):
     xqueue_body = {
         "grader_payload": json.dumps(grader_payload),
         "student_info": test_util.get_student_info(STUDENT_ID),
         "student_response": "Test! And longer now so tests pass.",
         "max_score": 1,
     }
     content = {"xqueue_header": test_util.get_xqueue_header(), "xqueue_body": json.dumps(xqueue_body)}
     return content
Пример #7
0
 def get_content(self, grader_payload):
     xqueue_body = {
         'grader_payload': json.dumps(grader_payload),
         'student_info': test_util.get_student_info(STUDENT_ID),
         'student_response': "Test! And longer now so tests pass.",
         'max_score': 1,
     }
     content = {
         'xqueue_header': test_util.get_xqueue_header(),
         'xqueue_body': json.dumps(xqueue_body),
     }
     return content
Пример #8
0
 def get_content(self, grader_payload):
     xqueue_body = {
         'grader_payload': json.dumps(grader_payload),
         'student_info': test_util.get_student_info(STUDENT_ID),
         'student_response': "Test! And longer now so tests pass.",
         'max_score': 1,
         }
     content = {
         'xqueue_header': test_util.get_xqueue_header(),
         'xqueue_body': json.dumps(xqueue_body),
         }
     return content
Пример #9
0
    def _message_submission(self, success, score=None, submission_id=None):
        sub = test_util.get_sub("IN", STUDENT_ID, LOCATION)
        sub.save()
        grade = test_util.get_grader("IN")
        grade.submission = sub
        grade.save()
        grader_id = grade.grader_id
        if submission_id is None:
            submission_id = sub.id

        message = {
            "grader_id": grader_id,
            "submission_id": submission_id,
            "feedback": "This is test feedback",
            "student_info": test_util.get_student_info(STUDENT_ID),
        }
        if score is not None:
            message["score"] = score

        content = {"xqueue_header": test_util.get_xqueue_header(), "xqueue_body": json.dumps(message)}
        content = self.c.post(SUBMIT_MESSAGE_URL, content)
        body = json.loads(content.content)
        self.assertEqual(body["success"], success)