summaryrefslogtreecommitdiff
path: root/src/tests/client/test-client.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/client/test-client.py')
-rwxr-xr-xsrc/tests/client/test-client.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/tests/client/test-client.py b/src/tests/client/test-client.py
index db4320ba7b..266de1155c 100755
--- a/src/tests/client/test-client.py
+++ b/src/tests/client/test-client.py
@@ -512,6 +512,16 @@ class Util:
os.remove(name)
+ @staticmethod
+ def pexpect_expect_all(pexp, *pattern_list):
+ # This will call "pexpect.expect()" on pattern_list,
+ # expecting all entries to match exactly once, in any
+ # order.
+ pattern_list = list(pattern_list)
+ while pattern_list:
+ idx = pexp.expect(pattern_list)
+ del pattern_list[idx]
+
###############################################################################
@@ -2071,8 +2081,11 @@ class TestNmcli(unittest.TestCase):
nmc = start_mon(self)
self.srv_shutdown()
- nmc.pexp.expect("eth0: device removed")
- nmc.pexp.expect("con-1: connection profile removed")
+ Util.pexpect_expect_all(
+ nmc.pexp,
+ "con-1: connection profile removed",
+ "eth0: device removed",
+ )
nmc.pexp.expect("NetworkManager is stopped")
end_mon(self, nmc)