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

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