Skip to content
Snippets Groups Projects
Commit a107e474 authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Fixed JSON validation, which was not taking order into account

More precisely, json data come from the JSONSink and this produces a list of non ordered items, one may call it a set.
Unfortunately JSON does not have such a concept so an ordered list is produced and the validator was naturally checking that the order was correct
parent b608885e
No related branches found
No related tags found
1 merge request!1496Fixed JSON validation, which was not taking order into account
Pipeline #6317700 passed
......@@ -1511,6 +1511,11 @@ class JSONOutputValidator:
# piggyback on TestCase dict diff report
t = TestCase()
# sort both lists (these are list of entities) as the order is not supposed to matter
# indeed, the JSONSink implementation does not garantee any particular order
# but as JSON does not have sets, we get back a sorted list here
expected = sorted(expected, key=lambda item: (item["component"], item["name"]))
out = sorted(out, key=lambda item: (item["component"], item["name"]))
try:
t.assertEqual(expected, out)
except AssertionError as err:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment