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.
"""
eq(len(got), len(want))
got = sorted(got, key=operator.attrgetter('id'))
want = sorted(want, key=operator.itemgetter('id'))
got = sorted(got, key=operator.attrgetter('id', 'permission'))
want = sorted(want, key=operator.itemgetter('id', 'permission'))
for g, w in zip(got, want):
w = dict(w)
eq(g.permission, w.pop('permission'))