From d74324a2d8ee314eceb7f47e67796777ddfa8c9d Mon Sep 17 00:00:00 2001 From: aarif Date: Mon, 21 Oct 2019 20:10:28 +0500 Subject: [PATCH] updated the comparison operation to make comparison consistent (irrespective of the order of items) changes made to allow non field dictionary comparisons as intended changes made to fix failure on reading values for dictionaries updated the comparison operation to make comparison consistent (irrespective of the order of items) changes made to allow non field dictionary comparisons as intended changes made to fix failure on reading values for dictionaries --- common/test/acceptance/tests/helpers.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/common/test/acceptance/tests/helpers.py b/common/test/acceptance/tests/helpers.py index dde919425c..6cf6c6ab21 100644 --- a/common/test/acceptance/tests/helpers.py +++ b/common/test/acceptance/tests/helpers.py @@ -660,11 +660,13 @@ class EventsTestMixin(TestCase): """ if in_order: for expected_event, actual_event in zip(expected_events, actual_events): - assert_event_matches( - expected_event, - actual_event, - tolerate=EventMatchTolerates.lenient() - ) + expected_field = (None if expected_event.get('event') is None else + expected_event.get('event').get('field')) + has_field = expected_field is not None + actual_event_to_compare = (next(item for item in actual_events if item.get('event').get('field') == + expected_field)) if has_field else actual_event + + assert_event_matches(expected_event, actual_event_to_compare, tolerate=EventMatchTolerates.lenient()) else: for expected_event in expected_events: actual_event = next(event for event in actual_events if is_matching_event(expected_event, event))