yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
ae23c9
From f737591acbcb84db4da620b94970bc3ac4e3b655 Mon Sep 17 00:00:00 2001
ae23c9
From: Yash Mankad <ymankad@redhat.com>
ae23c9
Date: Wed, 12 Dec 2018 00:14:37 +0000
ae23c9
Subject: [PATCH 09/13] Acceptance tests: add quick VNC tests
ae23c9
MIME-Version: 1.0
ae23c9
Content-Type: text/plain; charset=UTF-8
ae23c9
Content-Transfer-Encoding: 8bit
ae23c9
ae23c9
RH-Author: Yash Mankad <ymankad@redhat.com>
ae23c9
Message-id: <77eca16322a6a90444210ee11d64875df2746029.1544573601.git.ymankad@redhat.com>
ae23c9
Patchwork-id: 83434
ae23c9
O-Subject: [RHEL-8.0 qemu-kvm PATCH v2 3/7] Acceptance tests: add quick VNC tests
ae23c9
Bugzilla: 1655807
ae23c9
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
RH-Acked-by: John Snow <jsnow@redhat.com>
ae23c9
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ae23c9
ae23c9
From: Cleber Rosa <crosa@redhat.com>
ae23c9
ae23c9
This patch adds a few simple behavior tests for VNC.
ae23c9
ae23c9
Signed-off-by: Cleber Rosa <crosa@redhat.com>
ae23c9
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
Message-Id: <20180530184156.15634-4-crosa@redhat.com>
ae23c9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
ae23c9
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
ae23c9
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
(cherry picked from commit 7b1bd11cff0915a1266c34bdfb66d70f6372340d)
ae23c9
Signed-off-by: Yash Mankad <ymankad@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 tests/acceptance/vnc.py | 60 +++++++++++++++++++++++++++++++++++++++++++++++++
ae23c9
 1 file changed, 60 insertions(+)
ae23c9
 create mode 100644 tests/acceptance/vnc.py
ae23c9
ae23c9
diff --git a/tests/acceptance/vnc.py b/tests/acceptance/vnc.py
ae23c9
new file mode 100644
ae23c9
index 0000000..b1ef9d7
ae23c9
--- /dev/null
ae23c9
+++ b/tests/acceptance/vnc.py
ae23c9
@@ -0,0 +1,60 @@
ae23c9
+# Simple functional tests for VNC functionality
ae23c9
+#
ae23c9
+# Copyright (c) 2018 Red Hat, Inc.
ae23c9
+#
ae23c9
+# Author:
ae23c9
+#  Cleber Rosa <crosa@redhat.com>
ae23c9
+#
ae23c9
+# This work is licensed under the terms of the GNU GPL, version 2 or
ae23c9
+# later.  See the COPYING file in the top-level directory.
ae23c9
+
ae23c9
+from avocado_qemu import Test
ae23c9
+
ae23c9
+
ae23c9
+class Vnc(Test):
ae23c9
+    """
ae23c9
+    :avocado: enable
ae23c9
+    :avocado: tags=vnc,quick
ae23c9
+    """
ae23c9
+    def test_no_vnc(self):
ae23c9
+        self.vm.add_args('-nodefaults', '-S')
ae23c9
+        self.vm.launch()
ae23c9
+        self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
ae23c9
+
ae23c9
+    def test_no_vnc_change_password(self):
ae23c9
+        self.vm.add_args('-nodefaults', '-S')
ae23c9
+        self.vm.launch()
ae23c9
+        self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
ae23c9
+        set_password_response = self.vm.qmp('change',
ae23c9
+                                            device='vnc',
ae23c9
+                                            target='password',
ae23c9
+                                            arg='new_password')
ae23c9
+        self.assertIn('error', set_password_response)
ae23c9
+        self.assertEqual(set_password_response['error']['class'],
ae23c9
+                         'GenericError')
ae23c9
+        self.assertEqual(set_password_response['error']['desc'],
ae23c9
+                         'Could not set password')
ae23c9
+
ae23c9
+    def test_vnc_change_password_requires_a_password(self):
ae23c9
+        self.vm.add_args('-nodefaults', '-S', '-vnc', ':0')
ae23c9
+        self.vm.launch()
ae23c9
+        self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
ae23c9
+        set_password_response = self.vm.qmp('change',
ae23c9
+                                            device='vnc',
ae23c9
+                                            target='password',
ae23c9
+                                            arg='new_password')
ae23c9
+        self.assertIn('error', set_password_response)
ae23c9
+        self.assertEqual(set_password_response['error']['class'],
ae23c9
+                         'GenericError')
ae23c9
+        self.assertEqual(set_password_response['error']['desc'],
ae23c9
+                         'Could not set password')
ae23c9
+
ae23c9
+    def test_vnc_change_password(self):
ae23c9
+        self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password')
ae23c9
+        self.vm.launch()
ae23c9
+        self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
ae23c9
+        set_password_response = self.vm.qmp('change',
ae23c9
+                                            device='vnc',
ae23c9
+                                            target='password',
ae23c9
+                                            arg='new_password')
ae23c9
+        self.assertEqual(set_password_response['return'], {})
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9