[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 24/24] avocado_qemu: Add a few VNC related tests
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [RFC 24/24] avocado_qemu: Add a few VNC related tests |
Date: |
Fri, 20 Apr 2018 15:19:51 -0300 |
From: Cleber Rosa <address@hidden>
These exercise the basics of firing up QEMU with and without
a VNC device, and attempting to set the password when a VNC
device and password is given (or not).
Signed-off-by: Cleber Rosa <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
tests/avocado/test_vnc.py | 58 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100644 tests/avocado/test_vnc.py
diff --git a/tests/avocado/test_vnc.py b/tests/avocado/test_vnc.py
new file mode 100644
index 0000000000..f5fe26ead6
--- /dev/null
+++ b/tests/avocado/test_vnc.py
@@ -0,0 +1,58 @@
+from avocado import main
+from avocado_qemu import test
+
+
+class Vnc(test.QemuTest):
+ """
+ :avocado: enable
+ :avocado: tags=vnc,quick
+ """
+ def test_no_vnc(self):
+ self.vm.args = ['-nodefaults', '-S']
+ self.vm.launch()
+ self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
+
+ def test_no_vnc_change_password(self):
+ self.vm.args = ['-nodefaults', '-S']
+ self.vm.launch()
+ self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
+ set_password_response = self.vm.qmp('change',
+ device='vnc',
+ target='password',
+ arg='new_password')
+ self.assertIn('error', set_password_response)
+ self.assertEqual(set_password_response['error']['class'],
+ 'GenericError')
+ self.assertEqual(set_password_response['error']['desc'],
+ 'Could not set password')
+
+ def test_vnc_change_password_requires_a_password(self):
+ self.vm.args = ['-nodefaults', '-S', '-vnc', ':0']
+ self.vm.launch()
+ self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
+ set_password_response = self.vm.qmp('change',
+ device='vnc',
+ target='password',
+ arg='new_password')
+ self.assertIn('error', set_password_response)
+ self.assertEqual(set_password_response['error']['class'],
+ 'GenericError')
+ self.assertEqual(set_password_response['error']['desc'],
+ 'Could not set password')
+
+ def test_vnc_change_password(self):
+ self.vm.args = ['-nodefaults', '-S', '-vnc', ':0,password']
+ self.vm.launch()
+ self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
+ set_password_response = self.vm.qmp('change',
+ device='vnc',
+ target='password',
+ arg='new_password')
+ self.assertEqual(set_password_response['return'], {})
+
+ def tearDown(self):
+ self.vm.shutdown()
+
+
+if __name__ == '__main__':
+ main()
--
2.14.3
- [Qemu-devel] [RFC 15/24] avocado_qemu: Functional test for RHBZ#1436616, (continued)
- [Qemu-devel] [RFC 15/24] avocado_qemu: Functional test for RHBZ#1436616, Eduardo Habkost, 2018/04/20
- [Qemu-devel] [RFC 16/24] avocado_qemu: Functional test for RHBZ1473203, Eduardo Habkost, 2018/04/20
- [Qemu-devel] [RFC 17/24] avocado_qemu: Remove duplicate PortTracker implementation, Eduardo Habkost, 2018/04/20
- [Qemu-devel] [RFC 19/24] avocado_qemu: Clean unneeded 'pass', Eduardo Habkost, 2018/04/20
- [Qemu-devel] [RFC 18/24] avocado_qemu: Simplify the installation instructions, Eduardo Habkost, 2018/04/20
- [Qemu-devel] [RFC 20/24] avocado_qemu: Set QMP log level to INFO, Eduardo Habkost, 2018/04/20
- [Qemu-devel] [RFC 22/24] avocado_qemu: Tests fixes, Eduardo Habkost, 2018/04/20
- [Qemu-devel] [RFC 21/24] avocado_qemu: Introduce the add_image() VM API, Eduardo Habkost, 2018/04/20
- [Qemu-devel] [RFC 23/24] avocado_qemu: Force vmimage distro, Eduardo Habkost, 2018/04/20
- [Qemu-devel] [RFC 24/24] avocado_qemu: Add a few VNC related tests,
Eduardo Habkost <=
- Re: [Qemu-devel] [RFC 00/24] Avocado-based functional tests, no-reply, 2018/04/21