Commit 0b992c68 by Tim Krones

Address review comments.

parent 732405c2
...@@ -262,8 +262,9 @@ class ReviewStepBlock(MessageParentMixin, StudioContainerWithNestedXBlocksMixin, ...@@ -262,8 +262,9 @@ class ReviewStepBlock(MessageParentMixin, StudioContainerWithNestedXBlocksMixin,
@XBlock.json_handler @XBlock.json_handler
def get_assessment_message(self, grade, suffix): def get_assessment_message(self, grade, suffix):
complete = grade['complete'] # Data passed as "grade" comes from "get_grade" handler of Step Builder (MentoringWithExplicitStepsBlock)
max_attempts_reached = grade['max_attempts_reached'] complete = grade.get('complete')
max_attempts_reached = grade.get('max_attempts_reached')
return { return {
'assessment_message': self.assessment_message(complete, max_attempts_reached) 'assessment_message': self.assessment_message(complete, max_attempts_reached)
} }
......
from .base_test import CORRECT, INCORRECT, PARTIAL, MentoringAssessmentBaseTest, GetChoices from mock import patch
from ddt import ddt, data from ddt import ddt, data
from workbench.runtime import WorkbenchRuntime
from .base_test import CORRECT, INCORRECT, PARTIAL, MentoringAssessmentBaseTest, GetChoices
@ddt @ddt
class StepBuilderTest(MentoringAssessmentBaseTest): class StepBuilderTest(MentoringAssessmentBaseTest):
...@@ -238,8 +240,24 @@ class StepBuilderTest(MentoringAssessmentBaseTest): ...@@ -238,8 +240,24 @@ class StepBuilderTest(MentoringAssessmentBaseTest):
# Last step # Last step
# Submit MRQ, go to review # Submit MRQ, go to review
with patch.object(WorkbenchRuntime, 'publish') as patched_method:
self.multiple_response_question(None, step_builder, controls, ("Its beauty",), PARTIAL, last=True) self.multiple_response_question(None, step_builder, controls, ("Its beauty",), PARTIAL, last=True)
# Check if "grade" event was published
# Note that we can't use patched_method.assert_called_once_with here
# because there is no way to obtain a reference to the block instance generated from the XML scenario
self.assertTrue(patched_method.called)
self.assertEquals(len(patched_method.call_args_list), 1)
block_object = self.load_root_xblock()
positional_args = patched_method.call_args[0]
block, event, data = positional_args
self.assertEquals(block.scope_ids.usage_id, block_object.scope_ids.usage_id)
self.assertEquals(event, 'grade')
self.assertEquals(data, {'value': 0.625, 'max_value': 1})
# Review step # Review step
expected_results = { expected_results = {
"correct": 2, "partial": 1, "incorrect": 1, "percentage": 63, "correct": 2, "partial": 1, "incorrect": 1, "percentage": 63,
......
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