Merge pull request #186 from tipabu/check-grant-ordering

Care less about ordering when checking grants

Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2017-09-20 11:55:52 +03:00 committed by GitHub
commit 0826df92d2

View file

@ -81,8 +81,8 @@ def check_grants(got, want):
in any order. in any order.
""" """
eq(len(got), len(want)) eq(len(got), len(want))
got = sorted(got, key=operator.attrgetter('id')) got = sorted(got, key=operator.attrgetter('id', 'permission'))
want = sorted(want, key=operator.itemgetter('id')) want = sorted(want, key=operator.itemgetter('id', 'permission'))
for g, w in zip(got, want): for g, w in zip(got, want):
w = dict(w) w = dict(w)
eq(g.permission, w.pop('permission')) eq(g.permission, w.pop('permission'))