Commit 9249bafd by Ned Batchelder

Add a test of a bad answer also.

parent e69a0731
......@@ -841,6 +841,13 @@ class TestSubmittingProblems(LoginEnrollmentTestCase):
}
)
def reset_question_answer(self, problem_url_name):
'''resets specified problem for current user'''
problem_location = self.problem_location(problem_url_name)
modx_url = self.modx_url(problem_location, 'problem_reset')
resp = self.client.post(modx_url)
return resp
class TestCourseGrader(TestSubmittingProblems):
"""Check that a course gets graded properly"""
......@@ -896,16 +903,6 @@ class TestCourseGrader(TestSubmittingProblems):
'input_i4x-edX-graded-problem-%s_2_1' % problem_url_name: responses[0],
'input_i4x-edX-graded-problem-%s_2_2' % problem_url_name: responses[1],
})
print "modx_url", modx_url, "responses", responses
print "resp", resp
return resp
def reset_question_answer(self, problem_url_name):
'''resets specified problem for current user'''
problem_location = self.problem_location(problem_url_name)
modx_url = self.modx_url(problem_location, 'problem_reset')
resp = self.client.post(modx_url)
return resp
def test_get_graded(self):
......@@ -974,7 +971,7 @@ class TestCourseGrader(TestSubmittingProblems):
@override_settings(MODULESTORE=TEST_DATA_XML_MODULESTORE)
class TestSchematicResponse(TestSubmittingProblems):
"""Check that a course gets graded properly"""
"""Check that we can submit a schematic response, and it answers properly."""
course_slug = "embedded_python"
course_when = "2013_Spring"
......@@ -986,9 +983,6 @@ class TestSchematicResponse(TestSubmittingProblems):
resp = self.client.post(modx_url, {
'input_i4x-edX-embedded_python-problem-{0}_2_1'.format(problem_url_name): json.dumps(responses),
})
print "modx_url", modx_url, "responses", responses
print "resp", resp
return resp
def test_get_graded(self):
......@@ -1006,3 +1000,19 @@ class TestSchematicResponse(TestSubmittingProblems):
)
respdata = json.loads(resp.content)
self.assertEqual(respdata['success'], 'correct')
self.reset_question_answer('H1P1')
resp = self.submit_question_answer('H1P1',
[['transient', {'Z': [
[0.0000004, 2.8],
[0.0000009, 0.0], # wrong.
[0.0000014, 2.8],
[0.0000019, 2.8],
[0.0000024, 2.8],
[0.0000029, 0.2],
[0.0000034, 0.2],
[0.0000039, 0.2]
]}]]
)
respdata = json.loads(resp.content)
self.assertEqual(respdata['success'], 'incorrect')
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