More fixes to the merge, now all tests pass.

This commit is contained in:
Ned Batchelder
2013-03-06 11:15:02 -05:00
parent be79810ff6
commit efaa0eea03
2 changed files with 11 additions and 3 deletions

View File

@@ -1086,7 +1086,15 @@ class CustomResponse(LoncapaResponse):
# to the same correct/incorrect value
if 'ok' in ret:
correct = ['correct' if ret['ok'] else 'incorrect'] * len(idset)
self.context['messages'][0] = self.clean_message_html(ret['msg'])
msg = ret.get('msg', None)
msg = self.clean_message_html(msg)
# If there is only one input, apply the message to that input
# Otherwise, apply the message to the whole problem
if len(idset) > 1:
self.context['overall_message'] = msg
else:
self.context['messages'][0] = msg
# Another kind of dictionary the check function can return has
# the form:

View File

@@ -977,7 +977,7 @@ class CustomResponseTest(ResponseTest):
msg = correct_map.get_msg('1_2_1')
self.assertEqual(correctness, 'correct')
self.assertEqual(msg, "Message text\n")
self.assertEqual(msg, "Message text")
# Incorrect answer
input_dict = {'1_2_1': '0'}
@@ -987,7 +987,7 @@ class CustomResponseTest(ResponseTest):
msg = correct_map.get_msg('1_2_1')
self.assertEqual(correctness, 'incorrect')
self.assertEqual(msg, "Message text\n")
self.assertEqual(msg, "Message text")
def test_multiple_inputs_return_one_status(self):
# When given multiple inputs, the 'answer_given' argument