yeahuh / rpms / qemu-kvm

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