本文整理汇总了Python中lms.djangoapps.instructor_task.tests.test_base.InstructorTaskModuleTestCase.get_task_status方法的典型用法代码示例。如果您正苦于以下问题:Python InstructorTaskModuleTestCase.get_task_status方法的具体用法?Python InstructorTaskModuleTestCase.get_task_status怎么用?Python InstructorTaskModuleTestCase.get_task_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lms.djangoapps.instructor_task.tests.test_base.InstructorTaskModuleTestCase
的用法示例。
在下文中一共展示了InstructorTaskModuleTestCase.get_task_status方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _assert_task_failure
# 需要导入模块: from lms.djangoapps.instructor_task.tests.test_base import InstructorTaskModuleTestCase [as 别名]
# 或者: from lms.djangoapps.instructor_task.tests.test_base.InstructorTaskModuleTestCase import get_task_status [as 别名]
def _assert_task_failure(self, entry_id, task_type, problem_url_name, expected_message):
"""Confirm that expected values are stored in InstructorTask on task failure."""
instructor_task = InstructorTask.objects.get(id=entry_id)
self.assertEqual(instructor_task.task_state, FAILURE)
self.assertEqual(instructor_task.requester.username, 'instructor')
self.assertEqual(instructor_task.task_type, task_type)
task_input = json.loads(instructor_task.task_input)
self.assertNotIn('student', task_input)
self.assertEqual(task_input['problem_url'], InstructorTaskModuleTestCase.problem_location(problem_url_name).to_deprecated_string())
status = json.loads(instructor_task.task_output)
self.assertEqual(status['exception'], 'ZeroDivisionError')
self.assertEqual(status['message'], expected_message)
# check status returned:
status = InstructorTaskModuleTestCase.get_task_status(instructor_task.task_id)
self.assertEqual(status['message'], expected_message)
示例2: test_rescoring_code_problem
# 需要导入模块: from lms.djangoapps.instructor_task.tests.test_base import InstructorTaskModuleTestCase [as 别名]
# 或者: from lms.djangoapps.instructor_task.tests.test_base.InstructorTaskModuleTestCase import get_task_status [as 别名]
def test_rescoring_code_problem(self):
"""Run rescore scenario on problem with code submission"""
problem_url_name = 'H1P2'
self.define_code_response_problem(problem_url_name)
# we fully create the CodeResponse problem, but just pretend that we're queuing it:
with patch('capa.xqueue_interface.XQueueInterface.send_to_queue') as mock_send_to_queue:
mock_send_to_queue.return_value = (0, "Successfully queued")
self.submit_student_answer('u1', problem_url_name, ["answer1", "answer2"])
instructor_task = self.submit_rescore_all_student_answers('instructor', problem_url_name)
instructor_task = InstructorTask.objects.get(id=instructor_task.id)
self.assertEqual(instructor_task.task_state, FAILURE)
status = json.loads(instructor_task.task_output)
self.assertEqual(status['exception'], 'NotImplementedError')
self.assertEqual(status['message'], "Problem's definition does not support rescoring.")
status = InstructorTaskModuleTestCase.get_task_status(instructor_task.task_id)
self.assertEqual(status['message'], "Problem's definition does not support rescoring.")