diff --git a/common/lib/xmodule/xmodule/open_ended_module.py b/common/lib/xmodule/xmodule/open_ended_module.py index 7c3293730c..f32e0b26ff 100644 --- a/common/lib/xmodule/xmodule/open_ended_module.py +++ b/common/lib/xmodule/xmodule/open_ended_module.py @@ -410,6 +410,9 @@ class OpenEndedModule(openendedchild.OpenEndedChild): 'grader_id': id of the grader 'submission_id' : id of the submission 'success': whether or not this submission was successful + 'rubric_scores': a list of rubric scores + 'rubric_scores_complete': boolean if rubric scores are complete + 'rubric_xml': the xml of the rubric in string format } Returns (valid_score_msg, correct, score, msg): diff --git a/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py b/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py index 138424f021..847ac108dc 100644 --- a/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py +++ b/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py @@ -10,6 +10,13 @@ import capa.xqueue_interface as xqueue_interface from datetime import datetime from . import test_system +""" +Tests for the various pieces of the CombinedOpenEndedGrading system + +OpenEndedChild +OpenEndedModule + +""" class OpenEndedChildTest(unittest.TestCase): location = Location(["i4x", "edX", "sa_test", "selfassessment", @@ -130,12 +137,12 @@ class OpenEndedModuleTest(unittest.TestCase): metadata = json.dumps({'attempts': '10'}) prompt = etree.XML("This is a question prompt") - rubric = etree.XML(''' + rubric = etree.XML(''' Response Quality - ''') + ''') max_score = 4 static_data = { @@ -225,22 +232,28 @@ class OpenEndedModuleTest(unittest.TestCase): 'correct': True, 'score': 4, 'msg' : 'Grader Message', - 'feedback': feedback, + 'feedback': json.dumps(feedback), 'grader_type': 'IN', 'grader_id': '1', 'submission_id': '1', - 'success': True + 'success': True, + 'rubric_scores': [0], + 'rubric_scores_complete': True, + 'rubric_xml': etree.tostring(self.rubric) } get = {'queuekey': "abcd", 'xqueue_body': json.dumps(score_msg)} self.openendedmodule.update_score(get, test_system) - + def test_latest_post_assessment(self): + self.update_score_single() + assessment = self.openendedmodule.latest_post_assessment(test_system) + self.assertFalse(assessment == '') + # check for errors + self.assertFalse('errors' in assessment) def test_update_score(self): self.update_score_single() score = self.openendedmodule.latest_score() self.assertEqual(score, 4) - def test_latest_post_assessment(self): - self.update_score_single() diff --git a/common/lib/xmodule/xmodule/tests/test_self_assessment.py b/common/lib/xmodule/xmodule/tests/test_self_assessment.py index 55c198486c..9e138fef19 100644 --- a/common/lib/xmodule/xmodule/tests/test_self_assessment.py +++ b/common/lib/xmodule/xmodule/tests/test_self_assessment.py @@ -52,7 +52,7 @@ class SelfAssessmentTest(unittest.TestCase): def test_get_html(self): html = self.module.get_html(test_system) - self.assertTrue(html.find("This is sample prompt text") != -1) + self.assertTrue("This is sample prompt text" in html) def test_self_assessment_flow(self):