1 # Simple functional tests for VNC functionality
3 # Copyright (c) 2018 Red Hat, Inc.
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
17 :avocado: tags=vnc,quick
19 def test_no_vnc(self
):
20 self
.vm
.add_args('-nodefaults', '-S')
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')
27 self
.assertFalse(self
.vm
.qmp('query-vnc')['return']['enabled'])
28 set_password_response
= self
.vm
.qmp('change',
32 self
.assertIn('error', set_password_response
)
33 self
.assertEqual(set_password_response
['error']['class'],
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')
41 self
.assertTrue(self
.vm
.qmp('query-vnc')['return']['enabled'])
42 set_password_response
= self
.vm
.qmp('change',
46 self
.assertIn('error', set_password_response
)
47 self
.assertEqual(set_password_response
['error']['class'],
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')
55 self
.assertTrue(self
.vm
.qmp('query-vnc')['return']['enabled'])
56 set_password_response
= self
.vm
.qmp('change',
60 self
.assertEqual(set_password_response
['return'], {})