summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-12-13 10:02:27 +0100
committerThomas Haller <thaller@redhat.com>2019-12-13 13:19:31 +0100
commit7d048f1a5bb1af6aa8f05ad4a40e84b4da647731 (patch)
tree0aa231c4912890846dd496c521a4db9ff3889f25
parent52b89cb21ba511a8439dfc88a2be965aecce6c1f (diff)
downloadNetworkManager-7d048f1a5bb1af6aa8f05ad4a40e84b4da647731.tar.gz
clients/tests: support replacing UUIDs in command text
We want to issue a nmcli command with the connection's UUID in the command line. As the command line is stored to disk and compared, we cannot use UUIDs that are randomly generated. Instead, we need to support replacing the text in the command line.
-rwxr-xr-xclients/tests/test-client.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/clients/tests/test-client.py b/clients/tests/test-client.py
index 37c3e74908..03415cd031 100755
--- a/clients/tests/test-client.py
+++ b/clients/tests/test-client.py
@@ -594,6 +594,7 @@ class TestNmcli(NmTestBase):
expected_stderr = _DEFAULT_ARG,
replace_stdout = None,
replace_stderr = None,
+ replace_cmd = None,
sort_lines_stdout = False,
extra_env = None,
sync_barrier = False):
@@ -608,6 +609,7 @@ class TestNmcli(NmTestBase):
expected_stderr,
replace_stdout,
replace_stderr,
+ replace_cmd,
sort_lines_stdout,
extra_env,
sync_barrier,
@@ -625,6 +627,7 @@ class TestNmcli(NmTestBase):
expected_stderr = _DEFAULT_ARG,
replace_stdout = None,
replace_stderr = None,
+ replace_cmd = None,
sort_lines_stdout = False,
extra_env = None,
sync_barrier = None):
@@ -651,6 +654,7 @@ class TestNmcli(NmTestBase):
expected_stderr,
replace_stdout,
replace_stderr,
+ replace_cmd,
sort_lines_stdout,
extra_env,
sync_barrier,
@@ -666,6 +670,7 @@ class TestNmcli(NmTestBase):
expected_stderr,
replace_stdout,
replace_stderr,
+ replace_cmd,
sort_lines_stdout,
extra_env,
sync_barrier,
@@ -728,6 +733,8 @@ class TestNmcli(NmTestBase):
replace_stdout = list(replace_stdout)
if replace_stderr is not None:
replace_stderr = list(replace_stderr)
+ if replace_cmd is not None:
+ replace_cmd = list(replace_cmd)
if check_on_disk is _DEFAULT_ARG:
check_on_disk = ( expected_returncode is _DEFAULT_ARG
@@ -788,6 +795,7 @@ class TestNmcli(NmTestBase):
if check_on_disk:
cmd = '$NMCLI %s' % (' '.join([Util.quote(a) for a in args[1:]]))
+ cmd = Util.replace_text(cmd, replace_cmd)
content = ('location: %s\n' % (calling_location)).encode('utf8') + \
('cmd: %s\n' % (cmd)).encode('utf8') + \