Commit 484beef9 by muzaffaryousaf

adding test and test code.

TNL-900
parent 2c4d4efd
...@@ -244,6 +244,19 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel): ...@@ -244,6 +244,19 @@ class AssessmentWorkflow(TimeStampedModel, StatusModel):
if self.status == self.STATUS.done: if self.status == self.STATUS.done:
return return
# # If we submission workflow is cancelled then set the score to 0 and status to DONE.
# if False is not None:
# self.set_score(0)
# new_status = self.STATUS.done
#
# # Finally save our changes if the status has changed
# if self.status != new_status:
# self.status = new_status
# self.save()
# logger.info((
# u"Workflow for submission UUID {uuid} has updated status to {status}"
# ).format(uuid=self.submission_uuid, status=new_status))
# Update our AssessmentWorkflowStep models with the latest from our APIs # Update our AssessmentWorkflowStep models with the latest from our APIs
steps = self._get_steps() steps = self._get_steps()
step_for_name = {step.name:step for step in steps} step_for_name = {step.name:step for step in steps}
......
...@@ -103,6 +103,34 @@ class TestPeerAssessment(XBlockHandlerTestCase): ...@@ -103,6 +103,34 @@ class TestPeerAssessment(XBlockHandlerTestCase):
self.assertGreater(len(resp['msg']), 0) self.assertGreater(len(resp['msg']), 0)
@scenario('data/peer_assessment_scenario.xml', user_id='Bob') @scenario('data/peer_assessment_scenario.xml', user_id='Bob')
def test_peer_assess_for_already_cancelled_submission(self, xblock):
# Create a submission for this problem from another user
student_item = xblock.get_student_item_dict()
submission = xblock.create_submission(student_item, self.SUBMISSION)
# Create a submission for the scorer (required before assessing another student)
another_student = copy.deepcopy(student_item)
another_submission = xblock.create_submission(another_student, self.SUBMISSION)
assessment = self.ASSESSMENT
assessment['submission_uuid'] = assessment.get('submission_uuid', submission.get('uuid', None))
# Pull the submission to assess
peer_api.get_submission_to_assess(another_submission['uuid'], 3)
peer_api.cancel_submission_peer_workflow(
submission_uuid=submission['uuid'],
comments="Inappropriate Language.",
cancelled_by_id=another_student['student_id']
)
# Submit an assessment and expect a failure
resp = self.request(xblock, 'peer_assess', json.dumps(assessment), response_format='json')
self.assertEqual(resp['success'], False)
self.assertGreater(len(resp['msg']), 0)
@scenario('data/peer_assessment_scenario.xml', user_id='Bob')
def test_missing_keys_in_request(self, xblock): def test_missing_keys_in_request(self, xblock):
for missing in ['criterion_feedback', 'overall_feedback', 'options_selected']: for missing in ['criterion_feedback', 'overall_feedback', 'options_selected']:
assessment = copy.deepcopy(self.ASSESSMENT) assessment = copy.deepcopy(self.ASSESSMENT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment