diff --git a/common/lib/xmodule/xmodule/tests/test_import.py b/common/lib/xmodule/xmodule/tests/test_import.py index 90ec112f19..554e89ac74 100644 --- a/common/lib/xmodule/xmodule/tests/test_import.py +++ b/common/lib/xmodule/xmodule/tests/test_import.py @@ -339,19 +339,6 @@ class ImportTestCase(unittest.TestCase): self.assertRaises(etree.XMLSyntaxError, system.process_xml, bad_xml) - def test_selfassessment_import(self): - ''' - Check to see if definition_from_xml in self_assessment_module.py - works properly. Pulls data from the self_assessment directory in the test data directory. - ''' - - modulestore = XMLModuleStore(DATA_DIR, course_dirs=['self_assessment']) - - sa_id = "edX/sa_test/2012_Fall" - location = Location(["i4x", "edX", "sa_test", "selfassessment", "SampleQuestion"]) - sa_sample = modulestore.get_instance(sa_id, location) - #10 attempts is hard coded into SampleQuestion, which is the url_name of a selfassessment xml tag - self.assertEqual(sa_sample.metadata['attempts'], '10') def test_graphicslidertool_import(self): ''' diff --git a/common/lib/xmodule/xmodule/tests/test_self_assessment.py b/common/lib/xmodule/xmodule/tests/test_self_assessment.py index d89190b1e0..565483c586 100644 --- a/common/lib/xmodule/xmodule/tests/test_self_assessment.py +++ b/common/lib/xmodule/xmodule/tests/test_self_assessment.py @@ -4,6 +4,7 @@ import unittest from xmodule.self_assessment_module import SelfAssessmentModule from xmodule.modulestore import Location +from lxml import etree from . import test_system @@ -26,22 +27,37 @@ class SelfAssessmentTest(unittest.TestCase): state = json.dumps({'student_answers': ["Answer 1", "answer 2", "answer 3"], 'scores': [0, 1], 'hints': ['o hai'], - 'state': SelfAssessmentModule.ASSESSING, + 'state': SelfAssessmentModule.INITIAL, 'attempts': 2}) + rubric = ''' + + Response Quality + + + ''' + + prompt = etree.XML("Text") + static_data = { + 'max_attempts': 10, + 'rubric': etree.XML(rubric), + 'prompt': prompt, + 'max_score': 1 + } + module = SelfAssessmentModule(test_system, self.location, self.definition, self.descriptor, - state, {}, metadata=self.metadata) + static_data, state, metadata=self.metadata) self.assertEqual(module.get_score()['score'], 0) - self.assertTrue('answer 3' in module.get_html()) - self.assertFalse('answer 2' in module.get_html()) - module.save_assessment({'assessment': '0'}) - self.assertEqual(module.state, module.REQUEST_HINT) + module.save_answer({'student_answer': "I am an answer"}, test_system) + self.assertEqual(module.state, module.ASSESSING) - module.save_hint({'hint': 'hint for ans 3'}) + module.save_assessment({'assessment': '0'}, test_system) + self.assertEqual(module.state, module.POST_ASSESSMENT) + module.save_hint({'hint': 'this is a hint'}, test_system) self.assertEqual(module.state, module.DONE) d = module.reset({}) @@ -49,6 +65,6 @@ class SelfAssessmentTest(unittest.TestCase): self.assertEqual(module.state, module.INITIAL) # if we now assess as right, skip the REQUEST_HINT state - module.save_answer({'student_answer': 'answer 4'}) - module.save_assessment({'assessment': '1'}) + module.save_answer({'student_answer': 'answer 4'}, test_system) + module.save_assessment({'assessment': '1'}, test_system) self.assertEqual(module.state, module.DONE)