@@ -297,3 +297,45 @@ def test_support_for_disabled_format_with_invalid_data(self):
297297
298298 result = self ._plugin .run (task_vars = dict (ansible_validate_jsonschema_check_format = False ))
299299 self .assertIn ("All checks passed" , result ["msg" ])
300+
301+ def test_suppress_output_is_false (self ):
302+ """The `found` and `relative_schema` will output if suppress_output is false"""
303+
304+ self ._plugin ._task .args = {
305+ "engine" : "ansible.utils.jsonschema" ,
306+ "data" : IN_VALID_DATA ,
307+ "criteria" : CRITERIA_FORMAT_SUPPORT_CHECK ,
308+ }
309+
310+ result = self ._plugin .run (task_vars = None )
311+ error = result .get ('errors' , [])[0 ]
312+ self .assertIn ("found" , error )
313+ self .assertIn ("relative_schema" , error )
314+
315+ def test_suppress_output_is_true (self ):
316+ """The `found` and `relative_schema` will not output if suppress_output is True"""
317+
318+ self ._plugin ._task .args = {
319+ "engine" : "ansible.utils.jsonschema" ,
320+ "data" : IN_VALID_DATA ,
321+ "criteria" : CRITERIA_FORMAT_SUPPORT_CHECK ,
322+ }
323+
324+ result = self ._plugin .run (task_vars = dict (ansible_validate_jsonschema_suppress_output = True ))
325+ error = result .get ('errors' , [])[0 ]
326+ self .assertNotIn ("found" , error )
327+ self .assertNotIn ("relative_schema" , error )
328+
329+ def test_suppress_output_is_a_list (self ):
330+ """The fields in suppress_output will be suppressed"""
331+
332+ self ._plugin ._task .args = {
333+ "engine" : "ansible.utils.jsonschema" ,
334+ "data" : IN_VALID_DATA ,
335+ "criteria" : CRITERIA_FORMAT_SUPPORT_CHECK ,
336+ }
337+
338+ result = self ._plugin .run (task_vars = dict (ansible_validate_jsonschema_suppress_output = ['relative_schema' ]))
339+ error = result .get ('errors' , [])[0 ]
340+ self .assertIn ("found" , error )
341+ self .assertNotIn ("relative_schema" , error )
0 commit comments