mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
api: Fix caps in JSON validation error message.
This commit is contained in:
@@ -155,7 +155,7 @@ def has_request_variables(view_func):
|
|||||||
try:
|
try:
|
||||||
val = ujson.loads(val)
|
val = ujson.loads(val)
|
||||||
except Exception:
|
except Exception:
|
||||||
raise JsonableError(_('argument "%s" is not valid json.') % (param.post_var_name,))
|
raise JsonableError(_('Argument "%s" is not valid JSON.') % (param.post_var_name,))
|
||||||
|
|
||||||
error = param.validator(param.post_var_name, val)
|
error = param.validator(param.post_var_name, val)
|
||||||
if error:
|
if error:
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class CustomProfileFieldTest(ZulipTestCase):
|
|||||||
self.login(self.example_email("iago"))
|
self.login(self.example_email("iago"))
|
||||||
data = {"name": u"Phone", "field_type": "text id"} # type: Dict[str, Any]
|
data = {"name": u"Phone", "field_type": "text id"} # type: Dict[str, Any]
|
||||||
result = self.client_post("/json/realm/profile_fields", info=data)
|
result = self.client_post("/json/realm/profile_fields", info=data)
|
||||||
self.assert_json_error(result, u'argument "field_type" is not valid json.')
|
self.assert_json_error(result, u'Argument "field_type" is not valid JSON.')
|
||||||
|
|
||||||
data["name"] = ""
|
data["name"] = ""
|
||||||
data["field_type"] = 100
|
data["field_type"] = 100
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ class DecoratorTestCase(TestCase):
|
|||||||
request.POST['numbers'] = 'bad_value'
|
request.POST['numbers'] = 'bad_value'
|
||||||
with self.assertRaises(JsonableError) as cm:
|
with self.assertRaises(JsonableError) as cm:
|
||||||
get_total(request)
|
get_total(request)
|
||||||
self.assertEqual(str(cm.exception), 'argument "numbers" is not valid json.')
|
self.assertEqual(str(cm.exception), 'Argument "numbers" is not valid JSON.')
|
||||||
|
|
||||||
request.POST['numbers'] = ujson.dumps([1, 2, "what?", 4, 5, 6])
|
request.POST['numbers'] = ujson.dumps([1, 2, "what?", 4, 5, 6])
|
||||||
with self.assertRaises(JsonableError) as cm:
|
with self.assertRaises(JsonableError) as cm:
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class TutorialTests(ZulipTestCase):
|
|||||||
self.assert_json_error(result, "Missing 'type' argument")
|
self.assert_json_error(result, "Missing 'type' argument")
|
||||||
|
|
||||||
result = self.client_post("/json/tutorial_send_message", raw_params)
|
result = self.client_post("/json/tutorial_send_message", raw_params)
|
||||||
self.assert_json_error(result, 'argument "type" is not valid json.')
|
self.assert_json_error(result, 'Argument "type" is not valid JSON.')
|
||||||
|
|
||||||
raw_params = dict(
|
raw_params = dict(
|
||||||
type='INVALID',
|
type='INVALID',
|
||||||
|
|||||||
Reference in New Issue
Block a user