mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +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:
 | 
			
		||||
                    val = ujson.loads(val)
 | 
			
		||||
                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)
 | 
			
		||||
                if error:
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ class CustomProfileFieldTest(ZulipTestCase):
 | 
			
		||||
        self.login(self.example_email("iago"))
 | 
			
		||||
        data = {"name": u"Phone", "field_type": "text id"}  # type: Dict[str, Any]
 | 
			
		||||
        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["field_type"] = 100
 | 
			
		||||
 
 | 
			
		||||
@@ -166,7 +166,7 @@ class DecoratorTestCase(TestCase):
 | 
			
		||||
        request.POST['numbers'] = 'bad_value'
 | 
			
		||||
        with self.assertRaises(JsonableError) as cm:
 | 
			
		||||
            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])
 | 
			
		||||
        with self.assertRaises(JsonableError) as cm:
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ class TutorialTests(ZulipTestCase):
 | 
			
		||||
        self.assert_json_error(result, "Missing 'type' argument")
 | 
			
		||||
 | 
			
		||||
        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(
 | 
			
		||||
            type='INVALID',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user