Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 15, 2024
1 parent d8f536a commit 6b92fc6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 5 additions & 1 deletion plugins/sub_plugins/validate/jsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ def _validate_jsonschema(self):

suppress_fields = []
if suppress_output:
suppress_fields = suppress_output if isinstance(suppress_output, list) else ["found", "relative_schema"]
suppress_fields = (
suppress_output
if isinstance(suppress_output, list)
else ["found", "relative_schema"]
)

for validation_error in validation_errors:
if isinstance(validation_error, jsonschema.ValidationError):
Expand Down
10 changes: 6 additions & 4 deletions tests/unit/plugins/action/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def test_suppress_output_is_false(self):
}

result = self._plugin.run(task_vars=None)
error = result.get('errors', [])[0]
error = result.get("errors", [])[0]
self.assertIn("found", error)
self.assertIn("relative_schema", error)

Expand All @@ -323,7 +323,7 @@ def test_suppress_output_is_true(self):
}

result = self._plugin.run(task_vars=dict(ansible_validate_jsonschema_suppress_output=True))
error = result.get('errors', [])[0]
error = result.get("errors", [])[0]
self.assertNotIn("found", error)
self.assertNotIn("relative_schema", error)

Expand All @@ -337,7 +337,9 @@ def test_suppress_output_is_a_list(self):
"suppress_output": ["relative_schema"],
}

result = self._plugin.run(task_vars=dict(ansible_validate_jsonschema_suppress_output=['relative_schema']))
error = result.get('errors', [])[0]
result = self._plugin.run(
task_vars=dict(ansible_validate_jsonschema_suppress_output=["relative_schema"])
)
error = result.get("errors", [])[0]
self.assertIn("found", error)
self.assertNotIn("relative_schema", error)

0 comments on commit 6b92fc6

Please sign in to comment.