def test_invalid_json(self):
     """
     Test invalid json raises exception
     """
     for error_inputs, error_message in INVALID_JSON_INPUTS:
         for error_input in error_inputs:
             with self.assertRaisesRegexp(LtiError, error_message):
                 parse_result_json(error_input)
Beispiel #2
0
 def test_invalid_json(self):
     """
     Test invalid json raises exception
     """
     for error_inputs, error_message in INVALID_JSON_INPUTS:
         for error_input in error_inputs:
             with self.assertRaisesRegexp(LtiError, error_message):
                 parse_result_json(error_input)
 def test_valid_json(self):
     """
     Test valid json returns expected values
     """
     for json_str, expected_score, expected_comment in VALID_JSON_INPUTS:
         score, comment = parse_result_json(json_str)
         self.assertEqual(score, expected_score)
         self.assertEqual(comment, expected_comment)
Beispiel #4
0
 def test_valid_json(self):
     """
     Test valid json returns expected values
     """
     for json_str, expected_score, expected_comment in VALID_JSON_INPUTS:
         score, comment = parse_result_json(json_str)
         self.assertEqual(score, expected_score)
         self.assertEqual(comment, expected_comment)