]>
Commit | Line | Data |
---|---|---|
7b1bd11c CR |
1 | # Simple functional tests for VNC functionality |
2 | # | |
3 | # Copyright (c) 2018 Red Hat, Inc. | |
4 | # | |
5 | # Author: | |
6 | # Cleber Rosa <[email protected]> | |
7 | # | |
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. | |
10 | ||
11 | from avocado_qemu import Test | |
12 | ||
13 | ||
14 | class Vnc(Test): | |
15 | """ | |
7b1bd11c CR |
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']) | |
22 | ||
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']) | |
3e3267a9 PB |
27 | set_password_response = self.vm.qmp('change-vnc-password', |
28 | password='new_password') | |
7b1bd11c CR |
29 | self.assertIn('error', set_password_response) |
30 | self.assertEqual(set_password_response['error']['class'], | |
31 | 'GenericError') | |
32 | self.assertEqual(set_password_response['error']['desc'], | |
33 | 'Could not set password') | |
34 | ||
41a7af1c | 35 | def test_change_password_requires_a_password(self): |
7b1bd11c CR |
36 | self.vm.add_args('-nodefaults', '-S', '-vnc', ':0') |
37 | self.vm.launch() | |
38 | self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled']) | |
3e3267a9 PB |
39 | set_password_response = self.vm.qmp('change-vnc-password', |
40 | password='new_password') | |
7b1bd11c CR |
41 | self.assertIn('error', set_password_response) |
42 | self.assertEqual(set_password_response['error']['class'], | |
43 | 'GenericError') | |
44 | self.assertEqual(set_password_response['error']['desc'], | |
45 | 'Could not set password') | |
46 | ||
41a7af1c | 47 | def test_change_password(self): |
7b1bd11c CR |
48 | self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password') |
49 | self.vm.launch() | |
50 | self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled']) | |
3e3267a9 PB |
51 | set_password_response = self.vm.qmp('change-vnc-password', |
52 | password='new_password') | |
7b1bd11c | 53 | self.assertEqual(set_password_response['return'], {}) |