def test_to_json_with_extras(self): e = ValidationError("Boom", errors={"key": "value"}, foo="bar") expected_dict = { "reason": "Boom", "foo": "bar", "errors": {"key": "value"} } self.assertDictEqual(e.to_json(), expected_dict)
def test_to_json_with_extras(self): e = ValidationError("Boom", errors={"key": "value"}, foo="bar") expected_dict = { "reason": "Boom", "foo": "bar", "errors": { "key": "value" } } self.assertDictEqual(e.to_json(), expected_dict)
def test_to_json_with_no_errors(self): e = ValidationError("Boom") self.assertEqual(e.to_json(), {"reason": "Boom"})