vnc.py (0d37413c639d8f467fc92c86a1ed54ecdba5220d) vnc.py (b6aed193e5ecca32bb07e062f58f0daca06e7009)
1# Simple functional tests for VNC functionality
2#
3# Copyright (c) 2018 Red Hat, Inc.
4#
5# Author:
6# Cleber Rosa <crosa@redhat.com>
7#
8# This work is licensed under the terms of the GNU GPL, version 2 or

--- 74 unchanged lines hidden (view full) ---

83 'GenericError')
84 self.assertEqual(set_password_response['error']['desc'],
85 'Could not set password')
86
87 def test_change_password(self):
88 self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password=on')
89 self.vm.launch()
90 self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
1# Simple functional tests for VNC functionality
2#
3# Copyright (c) 2018 Red Hat, Inc.
4#
5# Author:
6# Cleber Rosa <crosa@redhat.com>
7#
8# This work is licensed under the terms of the GNU GPL, version 2 or

--- 74 unchanged lines hidden (view full) ---

83 'GenericError')
84 self.assertEqual(set_password_response['error']['desc'],
85 'Could not set password')
86
87 def test_change_password(self):
88 self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password=on')
89 self.vm.launch()
90 self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
91 set_password_response = self.vm.qmp('change-vnc-password',
92 password='new_password')
93 self.assertEqual(set_password_response['return'], {})
91 self.vm.cmd('change-vnc-password',
92 password='new_password')
94
95 def test_change_listen(self):
96 a, b, c = find_free_ports(3)
97 self.assertFalse(check_connect(a))
98 self.assertFalse(check_connect(b))
99 self.assertFalse(check_connect(c))
100
101 self.vm.add_args('-nodefaults', '-S', '-vnc', f'{VNC_ADDR}:{a - 5900}')
102 self.vm.launch()
103 self.assertEqual(self.vm.qmp('query-vnc')['return']['service'], str(a))
104 self.assertTrue(check_connect(a))
105 self.assertFalse(check_connect(b))
106 self.assertFalse(check_connect(c))
107
93
94 def test_change_listen(self):
95 a, b, c = find_free_ports(3)
96 self.assertFalse(check_connect(a))
97 self.assertFalse(check_connect(b))
98 self.assertFalse(check_connect(c))
99
100 self.vm.add_args('-nodefaults', '-S', '-vnc', f'{VNC_ADDR}:{a - 5900}')
101 self.vm.launch()
102 self.assertEqual(self.vm.qmp('query-vnc')['return']['service'], str(a))
103 self.assertTrue(check_connect(a))
104 self.assertFalse(check_connect(b))
105 self.assertFalse(check_connect(c))
106
108 res = self.vm.qmp('display-update', type='vnc',
109 addresses=[{'type': 'inet', 'host': VNC_ADDR,
110 'port': str(b)},
111 {'type': 'inet', 'host': VNC_ADDR,
112 'port': str(c)}])
113 self.assertEqual(res['return'], {})
107 self.vm.cmd('display-update', type='vnc',
108 addresses=[{'type': 'inet', 'host': VNC_ADDR,
109 'port': str(b)},
110 {'type': 'inet', 'host': VNC_ADDR,
111 'port': str(c)}])
114 self.assertEqual(self.vm.qmp('query-vnc')['return']['service'], str(b))
115 self.assertFalse(check_connect(a))
116 self.assertTrue(check_connect(b))
117 self.assertTrue(check_connect(c))
112 self.assertEqual(self.vm.qmp('query-vnc')['return']['service'], str(b))
113 self.assertFalse(check_connect(a))
114 self.assertTrue(check_connect(b))
115 self.assertTrue(check_connect(c))