Blame SOURCES/kvm-Acceptance-tests-add-quick-VNC-tests.patch

383d26
From 6d28e6c096b3015387788dc1f140df0be3c28a6f Mon Sep 17 00:00:00 2001
383d26
From: Yash Mankad <ymankad@redhat.com>
383d26
Date: Tue, 17 Jul 2018 23:38:06 +0200
383d26
Subject: [PATCH 49/89] Acceptance tests: add quick VNC tests
383d26
MIME-Version: 1.0
383d26
Content-Type: text/plain; charset=UTF-8
383d26
Content-Transfer-Encoding: 8bit
383d26
383d26
RH-Author: Yash Mankad <ymankad@redhat.com>
383d26
Message-id: <51cad6473c9d59a780befb5d96c8534affd938cf.1531870629.git.ymankad@redhat.com>
383d26
Patchwork-id: 81383
383d26
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 3/5] Acceptance tests: add quick VNC tests
383d26
Bugzilla:
383d26
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
383d26
RH-Acked-by: John Snow <jsnow@redhat.com>
383d26
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
383d26
383d26
From: Cleber Rosa <crosa@redhat.com>
383d26
383d26
This patch adds a few simple behavior tests for VNC.
383d26
383d26
Signed-off-by: Cleber Rosa <crosa@redhat.com>
383d26
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
383d26
Message-Id: <20180530184156.15634-4-crosa@redhat.com>
383d26
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
383d26
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
383d26
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
383d26
(cherry picked from commit 7b1bd11cff0915a1266c34bdfb66d70f6372340d)
383d26
Signed-off-by: Yash Mankad <ymankad@redhat.com>
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 tests/acceptance/vnc.py | 60 +++++++++++++++++++++++++++++++++++++++++++++++++
383d26
 1 file changed, 60 insertions(+)
383d26
 create mode 100644 tests/acceptance/vnc.py
383d26
383d26
diff --git a/tests/acceptance/vnc.py b/tests/acceptance/vnc.py
383d26
new file mode 100644
383d26
index 0000000..b1ef9d7
383d26
--- /dev/null
383d26
+++ b/tests/acceptance/vnc.py
383d26
@@ -0,0 +1,60 @@
383d26
+# Simple functional tests for VNC functionality
383d26
+#
383d26
+# Copyright (c) 2018 Red Hat, Inc.
383d26
+#
383d26
+# Author:
383d26
+#  Cleber Rosa <crosa@redhat.com>
383d26
+#
383d26
+# This work is licensed under the terms of the GNU GPL, version 2 or
383d26
+# later.  See the COPYING file in the top-level directory.
383d26
+
383d26
+from avocado_qemu import Test
383d26
+
383d26
+
383d26
+class Vnc(Test):
383d26
+    """
383d26
+    :avocado: enable
383d26
+    :avocado: tags=vnc,quick
383d26
+    """
383d26
+    def test_no_vnc(self):
383d26
+        self.vm.add_args('-nodefaults', '-S')
383d26
+        self.vm.launch()
383d26
+        self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
383d26
+
383d26
+    def test_no_vnc_change_password(self):
383d26
+        self.vm.add_args('-nodefaults', '-S')
383d26
+        self.vm.launch()
383d26
+        self.assertFalse(self.vm.qmp('query-vnc')['return']['enabled'])
383d26
+        set_password_response = self.vm.qmp('change',
383d26
+                                            device='vnc',
383d26
+                                            target='password',
383d26
+                                            arg='new_password')
383d26
+        self.assertIn('error', set_password_response)
383d26
+        self.assertEqual(set_password_response['error']['class'],
383d26
+                         'GenericError')
383d26
+        self.assertEqual(set_password_response['error']['desc'],
383d26
+                         'Could not set password')
383d26
+
383d26
+    def test_vnc_change_password_requires_a_password(self):
383d26
+        self.vm.add_args('-nodefaults', '-S', '-vnc', ':0')
383d26
+        self.vm.launch()
383d26
+        self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
383d26
+        set_password_response = self.vm.qmp('change',
383d26
+                                            device='vnc',
383d26
+                                            target='password',
383d26
+                                            arg='new_password')
383d26
+        self.assertIn('error', set_password_response)
383d26
+        self.assertEqual(set_password_response['error']['class'],
383d26
+                         'GenericError')
383d26
+        self.assertEqual(set_password_response['error']['desc'],
383d26
+                         'Could not set password')
383d26
+
383d26
+    def test_vnc_change_password(self):
383d26
+        self.vm.add_args('-nodefaults', '-S', '-vnc', ':0,password')
383d26
+        self.vm.launch()
383d26
+        self.assertTrue(self.vm.qmp('query-vnc')['return']['enabled'])
383d26
+        set_password_response = self.vm.qmp('change',
383d26
+                                            device='vnc',
383d26
+                                            target='password',
383d26
+                                            arg='new_password')
383d26
+        self.assertEqual(set_password_response['return'], {})
383d26
-- 
383d26
1.8.3.1
383d26