Skip to content

Commit 591e0cd

Browse files
committed
test: adjust test after jsonschema update 1
The action_params schema defines the "type" property as: anyOf: [{enum: [string, object, ...]}] jsonschema v2.6.0 reported the anyOf error "matched none of the schemas" jsonschema v3.2.0 is a bit more helpful by reporting the underlying enum error. I also looked at removing the anyOf (since there is only one entry), but the anyOf makes it easier to compare our action_params schema with the draft4 schema to make the differences very clear.
1 parent be09e03 commit 591e0cd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

st2api/tests/unit/controllers/v1/test_packs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,10 @@ def test_packs_register_endpoint(self, mock_get_packs):
679679
self.assertEqual(resp.status_int, 400)
680680
self.assertIn(expected_msg, resp.json["faultstring"])
681681

682-
expected_msg = "'stringa' is not valid under any of the given schemas"
682+
# with jsonschema 2.6.0, the anyOf validator errors with:
683+
# "'stringa' is not valid under any of the given schemas"
684+
# with jsonschema 3.2.0, the underlying enum (anyOf->enum) gets reported instead:
685+
expected_msg = "'stringa' is not one of ['array', 'boolean', 'integer', 'null', 'number', 'object', 'string']"
683686
self.assertEqual(resp.status_int, 400)
684687
self.assertIn(expected_msg, resp.json["faultstring"])
685688

0 commit comments

Comments
 (0)