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.

(cherry picked from commit 347253be2f)
This commit is contained in:
Thomas Haller 2019-12-13 10:05:00 +01:00
parent 1a20c9b2b5
commit 64f103416f

View file

@ -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():