mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Do not sort dictionaries in assert_deepequal utility function
Sorting lists of dictionaries in assert_deepequal was causing inconsistencies in unit test execution. To fix this, do not sort lists if their elements are dictionaries. https://fedorahosted.org/freeipa/ticket/3562
This commit is contained in:
committed by
Martin Kosek
parent
4f47ac9d7f
commit
18149fadb6
@@ -464,12 +464,6 @@ class test_netgroup(Declarative):
|
||||
truncated=False,
|
||||
summary=u'2 netgroups matched',
|
||||
result=[
|
||||
{
|
||||
'dn': fuzzy_netgroupdn,
|
||||
'cn': [netgroup2],
|
||||
'description': [u'Test netgroup 2'],
|
||||
'nisdomainname': [u'%s' % api.env.domain],
|
||||
},
|
||||
{
|
||||
'dn': fuzzy_netgroupdn,
|
||||
'memberhost_host': (host1,),
|
||||
@@ -478,6 +472,12 @@ class test_netgroup(Declarative):
|
||||
'description': [u'Test netgroup 1'],
|
||||
'nisdomainname': [u'%s' % api.env.domain],
|
||||
},
|
||||
{
|
||||
'dn': fuzzy_netgroupdn,
|
||||
'cn': [netgroup2],
|
||||
'description': [u'Test netgroup 2'],
|
||||
'nisdomainname': [u'%s' % api.env.domain],
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -316,6 +316,11 @@ def assert_deepequal(expected, got, doc='', stack=tuple()):
|
||||
raise AssertionError(
|
||||
LEN % (doc, len(expected), len(got), expected, got, stack)
|
||||
)
|
||||
# Sort list elements, unless they are dictionaries
|
||||
if expected and isinstance(expected[0], dict):
|
||||
s_got = got
|
||||
s_expected = expected
|
||||
else:
|
||||
s_got = sorted(got)
|
||||
s_expected = sorted(expected)
|
||||
for (i, e_sub) in enumerate(s_expected):
|
||||
|
||||
Reference in New Issue
Block a user