summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-12-13 10:03:18 +0100
committerThomas Haller <thaller@redhat.com>2019-12-13 13:19:31 +0100
commit0d24ac4996738815b050214281470eecf2b991be (patch)
treef88cc872c995ad698c284ffc497ee2a7abd23c52
parent7d048f1a5bb1af6aa8f05ad4a40e84b4da647731 (diff)
downloadNetworkManager-0d24ac4996738815b050214281470eecf2b991be.tar.gz
clients/tests: add NMStubServer.findConnections() helper function
Will be used to get all connection from the test stub server.
-rwxr-xr-xclients/tests/test-client.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/clients/tests/test-client.py b/clients/tests/test-client.py
index 03415cd031..b1b912a273 100755
--- a/clients/tests/test-client.py
+++ b/clients/tests/test-client.py
@@ -441,11 +441,8 @@ class NMStubServer:
if kwargs:
# for convenience, we allow the caller to specify arguments
# as kwargs. In this case, we construct a a{sv} array as last argument.
- kwargs2 = {}
args = list(args)
- args.append(kwargs2)
- for k in kwargs.keys():
- kwargs2[k] = kwargs[k]
+ args.append(kwargs)
return method(*args)
def __getattr__(self, member):
@@ -456,9 +453,16 @@ class NMStubServer:
def addConnection(self, connection, do_verify_strict = True):
return self.op_AddConnection(connection, do_verify_strict)
+ def findConnections(self, **kwargs):
+ if kwargs:
+ lst = self.op_FindConnections(**kwargs)
+ else:
+ lst = self.op_FindConnections( { } )
+ return list([ (str(elem[0]), str(elem[1]), str(elem[2])) for elem in lst ])
+
def findConnectionUuid(self, con_id, required = True):
try:
- u = Util.iter_single(self.op_FindConnections(con_id = con_id))[1]
+ u = Util.iter_single(self.findConnections(con_id = con_id))[1]
assert u, ("Invalid uuid %s" % (u))
except Exception as e:
if not required: