Test full flow, including reset

This commit is contained in:
Vik Paruchuri
2013-05-08 18:15:57 -04:00
parent f26a258598
commit 4d759e9772
2 changed files with 29 additions and 0 deletions

View File

@@ -803,6 +803,18 @@ class CombinedOpenEndedV1Module():
return progress_object
def out_of_sync_error(self, get, msg=''):
"""
return dict out-of-sync error message, and also log.
"""
#This is a dev_facing_error
log.warning("Combined module state out sync. state: %r, get: %r. %s",
self.state, get, msg)
#This is a student_facing_error
return {'success': False,
'error': 'The problem state got out-of-sync. Please try reloading the page.'}
class CombinedOpenEndedV1Descriptor():
"""

View File

@@ -604,8 +604,10 @@ class OpenEndedModuleXmlTest(unittest.TestCase):
#This error is okay. We don't have a grading service to connect to!
pass
#Try to get the rubric from the module
module.handle_ajax("get_combined_rubric", {})
#Make a fake reply from the queue
queue_reply = {
'queuekey' : "",
'xqueue_body' : json.dumps({
@@ -620,5 +622,20 @@ class OpenEndedModuleXmlTest(unittest.TestCase):
})
}
module.handle_ajax("check_for_score", {})
#Update the module with the fake queue reply
module.handle_ajax("score_update", queue_reply)
#Get html and other data client will request
html = module.get_html()
legend = module.handle_ajax("get_legend", {})
status = module.handle_ajax("get_status", {})
legend = module.handle_ajax("skip_post_assessment", {})
#Get all results
legend = module.handle_ajax("get_results", {})
log.info(module.task_states)
#reset the problem
module.handle_ajax("reset", {})