hw/net/virtio-net:Remove redundant statement in virtio_net_rsc_tcp_ctrl_check()
[qemu/kevin.git] / tests / acceptance / vnc.py
blob3f40bc2be11182b38d026105a315a6196eefba96
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: tags=vnc,quick
17 """
18 def test_no_vnc(self):
19 self.vm.add_args('-nodefaults', '-S')
20 self.vm.launch()
21 self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
23 def test_no_vnc_change_password(self):
24 self.vm.add_args('-nodefaults', '-S')
25 self.vm.launch()
26 self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
27 set_password_response = self.vm.qmp('change',
28 device='vnc',
29 target='password',
30 arg='new_password')
31 self.assertIn('error', set_password_response)
32 self.assertEqual(set_password_response['error']['class'],
33 'GenericError')
34 self.assertEqual(set_password_response['error']['desc'],
35 'Could not set password')
37 def test_change_password_requires_a_password(self):
38 self.vm.add_args('-nodefaults', '-S', '-vnc', ':0')
39 self.vm.launch()
40 self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
41 set_password_response = self.vm.qmp('change',
42 device='vnc',
43 target='password',
44 arg='new_password')
45 self.assertIn('error', set_password_response)
46 self.assertEqual(set_password_response['error']['class'],
47 'GenericError')
48 self.assertEqual(set_password_response['error']['desc'],
49 'Could not set password')
51 def test_change_password(self):
52 self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password')
53 self.vm.launch()
54 self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
55 set_password_response = self.vm.qmp('change',
56 device='vnc',
57 target='password',
58 arg='new_password')
59 self.assertEqual(set_password_response['return'], {})