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

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