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
16 :avocado: tags=vnc,quick
18 def test_no_vnc(self
):
19 self
.vm
.add_args('-nodefaults', '-S')
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')
26 self
.assertFalse(self
.vm
.qmp('query-vnc')['return']['enabled'])
27 set_password_response
= self
.vm
.qmp('change',
31 self
.assertIn('error', set_password_response
)
32 self
.assertEqual(set_password_response
['error']['class'],
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')
40 self
.assertTrue(self
.vm
.qmp('query-vnc')['return']['enabled'])
41 set_password_response
= self
.vm
.qmp('change',
45 self
.assertIn('error', set_password_response
)
46 self
.assertEqual(set_password_response
['error']['class'],
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')
54 self
.assertTrue(self
.vm
.qmp('query-vnc')['return']['enabled'])
55 set_password_response
= self
.vm
.qmp('change',
59 self
.assertEqual(set_password_response
['return'], {})