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-vnc-password',
28 password
='new_password')
29 self
.assertIn('error', set_password_response
)
30 self
.assertEqual(set_password_response
['error']['class'],
32 self
.assertEqual(set_password_response
['error']['desc'],
33 'Could not set password')
35 def test_change_password_requires_a_password(self
):
36 self
.vm
.add_args('-nodefaults', '-S', '-vnc', ':0')
38 self
.assertTrue(self
.vm
.qmp('query-vnc')['return']['enabled'])
39 set_password_response
= self
.vm
.qmp('change-vnc-password',
40 password
='new_password')
41 self
.assertIn('error', set_password_response
)
42 self
.assertEqual(set_password_response
['error']['class'],
44 self
.assertEqual(set_password_response
['error']['desc'],
45 'Could not set password')
47 def test_change_password(self
):
48 self
.vm
.add_args('-nodefaults', '-S', '-vnc', ':0,password')
50 self
.assertTrue(self
.vm
.qmp('query-vnc')['return']['enabled'])
51 set_password_response
= self
.vm
.qmp('change-vnc-password',
52 password
='new_password')
53 self
.assertEqual(set_password_response
['return'], {})