summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-05-11 11:09:07 +0200
committerThomas Haller <thaller@redhat.com>2023-05-15 14:59:58 +0200
commit50f97307c5e00157fdd29d3b61ee873f9cb5886b (patch)
tree7e8c4b04bdbc7e9ff007d5a4509fa361f9bc55b1
parent1c32b59ebdd48b9a6315d4c29f72dcaabc645fe2 (diff)
downloadNetworkManager-50f97307c5e00157fdd29d3b61ee873f9cb5886b.tar.gz
test-client: move TestNmClient.ReplaceTextConUuid() to NMStubServer
The goal is to make the base class TestNmClient smaller because it contains a lot of state, and with inheritance it's hard to follow what happens.
-rwxr-xr-xsrc/tests/client/test-client.py30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/tests/client/test-client.py b/src/tests/client/test-client.py
index 3cd2a71108..d752fd9f34 100755
--- a/src/tests/client/test-client.py
+++ b/src/tests/client/test-client.py
@@ -948,6 +948,12 @@ class NMStubServer:
)
return u
+ def ReplaceTextConUuid(self, con_name, replacement):
+ return Util.ReplaceTextSimple(
+ Util.memoize_nullary(lambda: self.findConnectionUuid(con_name)),
+ replacement,
+ )
+
def setProperty(self, path, propname, value, iface_name=None):
if iface_name is None:
iface_name = ""
@@ -1066,12 +1072,6 @@ class TestNmClient(unittest.TestCase):
self.srv = None
srv.shutdown()
- def ReplaceTextConUuid(self, con_name, replacement):
- return Util.ReplaceTextSimple(
- Util.memoize_nullary(lambda: self.srv.findConnectionUuid(con_name)),
- replacement,
- )
-
def async_start(self, wait_all=False):
while True:
@@ -1590,7 +1590,9 @@ class TestNmcli(TestNmClient):
replace_uuids = []
replace_uuids.append(
- self.ReplaceTextConUuid("con-xx1", "UUID-con-xx1-REPLACED-REPLACED-REPLA")
+ self.srv.ReplaceTextConUuid(
+ "con-xx1", "UUID-con-xx1-REPLACED-REPLACED-REPLA"
+ )
)
self.call_nmcli(
@@ -1603,7 +1605,7 @@ class TestNmcli(TestNmClient):
for con_name, apn in con_gsm_list:
replace_uuids.append(
- self.ReplaceTextConUuid(
+ self.srv.ReplaceTextConUuid(
con_name, "UUID-" + con_name + "-REPLACED-REPLACED-REPL"
)
)
@@ -1635,7 +1637,9 @@ class TestNmcli(TestNmClient):
)
replace_uuids.append(
- self.ReplaceTextConUuid("ethernet", "UUID-ethernet-REPLACED-REPLACED-REPL")
+ self.srv.ReplaceTextConUuid(
+ "ethernet", "UUID-ethernet-REPLACED-REPLACED-REPL"
+ )
)
self.call_nmcli(
@@ -1764,7 +1768,9 @@ class TestNmcli(TestNmClient):
replace_uuids = []
replace_uuids.append(
- self.ReplaceTextConUuid("con-xx1", "UUID-con-xx1-REPLACED-REPLACED-REPLA")
+ self.srv.ReplaceTextConUuid(
+ "con-xx1", "UUID-con-xx1-REPLACED-REPLACED-REPLA"
+ )
)
self.call_nmcli(
@@ -1810,7 +1816,9 @@ class TestNmcli(TestNmClient):
self.async_wait()
replace_uuids.append(
- self.ReplaceTextConUuid("con-vpn-1", "UUID-con-vpn-1-REPLACED-REPLACED-REP")
+ self.srv.ReplaceTextConUuid(
+ "con-vpn-1", "UUID-con-vpn-1-REPLACED-REPLACED-REP"
+ )
)
self.call_nmcli(