Commit 71d27def by Diana Huang

Fix tests and add new documentation

parent 3ec2a83e
...@@ -410,6 +410,9 @@ class OpenEndedModule(openendedchild.OpenEndedChild): ...@@ -410,6 +410,9 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
'grader_id': id of the grader 'grader_id': id of the grader
'submission_id' : id of the submission 'submission_id' : id of the submission
'success': whether or not this submission was successful '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): Returns (valid_score_msg, correct, score, msg):
......
...@@ -10,6 +10,13 @@ import capa.xqueue_interface as xqueue_interface ...@@ -10,6 +10,13 @@ import capa.xqueue_interface as xqueue_interface
from datetime import datetime from datetime import datetime
from . import test_system from . import test_system
"""
Tests for the various pieces of the CombinedOpenEndedGrading system
OpenEndedChild
OpenEndedModule
"""
class OpenEndedChildTest(unittest.TestCase): class OpenEndedChildTest(unittest.TestCase):
location = Location(["i4x", "edX", "sa_test", "selfassessment", location = Location(["i4x", "edX", "sa_test", "selfassessment",
...@@ -130,12 +137,12 @@ class OpenEndedModuleTest(unittest.TestCase): ...@@ -130,12 +137,12 @@ class OpenEndedModuleTest(unittest.TestCase):
metadata = json.dumps({'attempts': '10'}) metadata = json.dumps({'attempts': '10'})
prompt = etree.XML("<prompt>This is a question prompt</prompt>") prompt = etree.XML("<prompt>This is a question prompt</prompt>")
rubric = etree.XML('''<rubric><rubric> rubric = etree.XML('''<rubric>
<category> <category>
<description>Response Quality</description> <description>Response Quality</description>
<option>The response is not a satisfactory answer to the question. It either fails to address the question or does so in a limited way, with no evidence of higher-order thinking.</option> <option>The response is not a satisfactory answer to the question. It either fails to address the question or does so in a limited way, with no evidence of higher-order thinking.</option>
</category> </category>
</rubric></rubric>''') </rubric>''')
max_score = 4 max_score = 4
static_data = { static_data = {
...@@ -225,22 +232,28 @@ class OpenEndedModuleTest(unittest.TestCase): ...@@ -225,22 +232,28 @@ class OpenEndedModuleTest(unittest.TestCase):
'correct': True, 'correct': True,
'score': 4, 'score': 4,
'msg' : 'Grader Message', 'msg' : 'Grader Message',
'feedback': feedback, 'feedback': json.dumps(feedback),
'grader_type': 'IN', 'grader_type': 'IN',
'grader_id': '1', 'grader_id': '1',
'submission_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", get = {'queuekey': "abcd",
'xqueue_body': json.dumps(score_msg)} 'xqueue_body': json.dumps(score_msg)}
self.openendedmodule.update_score(get, test_system) 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): def test_update_score(self):
self.update_score_single() self.update_score_single()
score = self.openendedmodule.latest_score() score = self.openendedmodule.latest_score()
self.assertEqual(score, 4) self.assertEqual(score, 4)
def test_latest_post_assessment(self):
self.update_score_single()
...@@ -52,7 +52,7 @@ class SelfAssessmentTest(unittest.TestCase): ...@@ -52,7 +52,7 @@ class SelfAssessmentTest(unittest.TestCase):
def test_get_html(self): def test_get_html(self):
html = self.module.get_html(test_system) 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): def test_self_assessment_flow(self):
......
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