aboutsummaryrefslogtreecommitdiff
path: root/tests/avocado/vnc.py
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>2023-10-06 18:41:25 +0300
committerJohn Snow <jsnow@redhat.com>2023-10-12 14:21:44 -0400
commitb6aed193e5ecca32bb07e062f58f0daca06e7009 (patch)
tree869a1bf90b35f8bff095472c3c9f9ccd5631fe26 /tests/avocado/vnc.py
parent25ad2cf6500db3b7f2d88de448791183d7614097 (diff)
downloadqemu-b6aed193e5ecca32bb07e062f58f0daca06e7009.zip
qemu-b6aed193e5ecca32bb07e062f58f0daca06e7009.tar.gz
qemu-b6aed193e5ecca32bb07e062f58f0daca06e7009.tar.bz2
python: use vm.cmd() instead of vm.qmp() where appropriate
In many cases we just want an effect of qmp command and want to raise on failure. Use vm.cmd() method which does exactly this. The commit is generated by command git grep -l '\.qmp(' | xargs ./scripts/python_qmp_updater.py And then, fix self.assertRaises to expect ExecuteError exception in tests/qemu-iotests/124 Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20231006154125.1068348-16-vsementsov@yandex-team.ru Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'tests/avocado/vnc.py')
-rw-r--r--tests/avocado/vnc.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/avocado/vnc.py b/tests/avocado/vnc.py
index aeeefc7..862c899 100644
--- a/tests/avocado/vnc.py
+++ b/tests/avocado/vnc.py
@@ -88,9 +88,8 @@ class Vnc(QemuSystemTest):
self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password=on')
self.vm.launch()
self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
- set_password_response = self.vm.qmp('change-vnc-password',
- password='new_password')
- self.assertEqual(set_password_response['return'], {})
+ self.vm.cmd('change-vnc-password',
+ password='new_password')
def test_change_listen(self):
a, b, c = find_free_ports(3)
@@ -105,12 +104,11 @@ class Vnc(QemuSystemTest):
self.assertFalse(check_connect(b))
self.assertFalse(check_connect(c))
- res = self.vm.qmp('display-update', type='vnc',
- addresses=[{'type': 'inet', 'host': VNC_ADDR,
- 'port': str(b)},
- {'type': 'inet', 'host': VNC_ADDR,
- 'port': str(c)}])
- self.assertEqual(res['return'], {})
+ self.vm.cmd('display-update', type='vnc',
+ addresses=[{'type': 'inet', 'host': VNC_ADDR,
+ 'port': str(b)},
+ {'type': 'inet', 'host': VNC_ADDR,
+ 'port': str(c)}])
self.assertEqual(self.vm.qmp('query-vnc')['return']['service'], str(b))
self.assertFalse(check_connect(a))
self.assertTrue(check_connect(b))