mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-26 16:16:31 -06:00
Fixing test_backup_and_restore assert to do not rely on the order
Since we cannot assume that LDAP will return data in any ordered way, the test should be changed to do not rely on that. Instead of just comparing the output of the show-user command, this change first order the groups returned in the 'Member of Group' field before compare them. https://pagure.io/freeipa/issue/7339 Reviewed-By: Aleksei Slaikovskii <aslaikov@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
e55969f7e0
commit
cd660d1922
@ -65,6 +65,15 @@ def check_admin_in_ldap(host):
|
||||
def check_admin_in_cli(host):
|
||||
result = host.run_command(['ipa', 'user-show', 'admin'])
|
||||
assert 'User login: admin' in result.stdout_text, result.stdout_text
|
||||
|
||||
# LDAP do not guarantee any order, so the test cannot assume it. Based on
|
||||
# that, the code bellow order the 'Member of groups' field to able to
|
||||
# assert it latter.
|
||||
data = dict(re.findall("\W*(.+):\W*(.+)\W*", result.stdout_text))
|
||||
data["Member of groups"] = ', '.join(sorted(data["Member of groups"]
|
||||
.split(", ")))
|
||||
result.stdout_text = ''.join([' {}: {}\n'.format(k, v)
|
||||
for k, v in data.items()])
|
||||
return result
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user