summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-12-13 10:05:00 +0100
committerThomas Haller <thaller@redhat.com>2019-12-13 13:19:31 +0100
commit347253be2f3db7185dadecbd4fc10e172d5dc141 (patch)
tree486dc88e4215247bc0be084dcf3cc1b4eb630a7c
parent0d24ac4996738815b050214281470eecf2b991be (diff)
downloadNetworkManager-347253be2f3db7185dadecbd4fc10e172d5dc141.tar.gz
clients/tests: support Util.replace_text_sort_list() helper
This will be necessary to sort a list of text that contains text to replace. The use case is to get all UUIDs from the server, but some of these UUIDs are dynamic. So, in order to have a fixed sort order, we need to handle sorting the list, based on the replacement.
-rwxr-xr-xclients/tests/test-client.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/clients/tests/test-client.py b/clients/tests/test-client.py
index b1b912a273..4a0201ccca 100755
--- a/clients/tests/test-client.py
+++ b/clients/tests/test-client.py
@@ -309,6 +309,12 @@ class Util:
bb = bb.decode('utf-8')
return bb
+ @staticmethod
+ def replace_text_sort_list(lst, replace_arr):
+ lst = [ (Util.replace_text(elem, replace_arr), elem) for elem in lst ]
+ lst = sorted(lst)
+ lst = [ tup[1] for tup in lst ]
+ return list(lst)
@staticmethod
def debug_dbus_interface():