monitor: Fix tracepoint crash on JSON syntax error
[qemu/armbru.git] / tests / acceptance / vnc.py
blobb1ef9d71b17ed3f18579e589d727464d4a4cffcd
1 # Simple functional tests for VNC functionality
3 # Copyright (c) 2018 Red Hat, Inc.
5 # Author:
6 # Cleber Rosa <crosa@redhat.com>
8 # This work is licensed under the terms of the GNU GPL, version 2 or
9 # later. See the COPYING file in the top-level directory.
11 from avocado_qemu import Test
14 class Vnc(Test):
15 """
16 :avocado: enable
17 :avocado: tags=vnc,quick
18 """
19 def test_no_vnc(self):
20 self.vm.add_args('-nodefaults', '-S')
21 self.vm.launch()
22 self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
24 def test_no_vnc_change_password(self):
25 self.vm.add_args('-nodefaults', '-S')
26 self.vm.launch()
27 self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
28 set_password_response = self.vm.qmp('change',
29 device='vnc',
30 target='password',
31 arg='new_password')
32 self.assertIn('error', set_password_response)
33 self.assertEqual(set_password_response['error']['class'],
34 'GenericError')
35 self.assertEqual(set_password_response['error']['desc'],
36 'Could not set password')
38 def test_vnc_change_password_requires_a_password(self):
39 self.vm.add_args('-nodefaults', '-S', '-vnc', ':0')
40 self.vm.launch()
41 self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
42 set_password_response = self.vm.qmp('change',
43 device='vnc',
44 target='password',
45 arg='new_password')
46 self.assertIn('error', set_password_response)
47 self.assertEqual(set_password_response['error']['class'],
48 'GenericError')
49 self.assertEqual(set_password_response['error']['desc'],
50 'Could not set password')
52 def test_vnc_change_password(self):
53 self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password')
54 self.vm.launch()
55 self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
56 set_password_response = self.vm.qmp('change',
57 device='vnc',
58 target='password',
59 arg='new_password')
60 self.assertEqual(set_password_response['return'], {})