Blame SOURCES/0012-test-Test-machine-keys-against-md5-and-non-md5.patch

ce15b8
From 4e3c9deef6bdd76e9ea4d0bc34d8407e4e8c2c49 Mon Sep 17 00:00:00 2001
2587cc
From: Dominik Perpeet <dperpeet@redhat.com>
2587cc
Date: Thu, 20 Apr 2017 09:47:17 +0200
ce15b8
Subject: [PATCH 12/23] test: Test machine keys against md5 and non-md5
2587cc
2587cc
We don't care which format is used, so just test against both instead of
2587cc
determining what we think is used depending on the distribution.
2587cc
2587cc
commit 50ffe4dc22739792ccd6ef9d2ef216d9ed5f73f8
2587cc
2587cc
Closes #7025
2587cc
Reviewed-by: Stef Walter <stefw@redhat.com>
2587cc
---
2587cc
 test/verify/check-multi-machine-key | 27 ++++++++-------------------
2587cc
 1 file changed, 8 insertions(+), 19 deletions(-)
2587cc
2587cc
diff --git a/test/verify/check-multi-machine-key b/test/verify/check-multi-machine-key
2587cc
index d8fe921..04c3457 100755
2587cc
--- a/test/verify/check-multi-machine-key
2587cc
+++ b/test/verify/check-multi-machine-key
2587cc
@@ -61,11 +61,6 @@ class TestMultiMachineKeyAuth(MachineCase):
2587cc
         'machine2': { }
2587cc
     }
2587cc
 
2587cc
-    def use_md5(self, m):
2587cc
-        return 'rhel' in m.image or 'centos' in m.image or \
2587cc
-                m.image == "continuous-atomic" or \
2587cc
-                m.image == "debian-8"
2587cc
-
2587cc
     def load_key(self, name, password):
2587cc
         self.browser.switch_to_top()
2587cc
         self.browser.eval_js("loaded = false")
2587cc
@@ -87,11 +82,12 @@ class TestMultiMachineKeyAuth(MachineCase):
2587cc
         """.format(name, password))
2587cc
         self.browser.eval_js("cockpit.user().done(load)")
2587cc
 
2587cc
-    def check_keys(self, keys):
2587cc
+    def check_keys(self, keys_md5, keys):
2587cc
         def normalize(k):
2587cc
             return re.sub("/home/admin/\\.ssh/[^ ]*|test@test|ecdsa w/o comment", "", k)
2587cc
-        self.assertEqual(normalize(self.browser.eval_js("cockpit.spawn([ 'ssh-add', '-l' ])")),
2587cc
-                         normalize("\n".join(keys) + "\n"))
2587cc
+        self.assertIn(normalize(self.browser.eval_js("cockpit.spawn([ 'ssh-add', '-l' ])")),
2587cc
+                      [normalize("\n".join(keys_md5) + "\n"),
2587cc
+                       normalize("\n".join(keys) + "\n")])
2587cc
 
2587cc
     def setUp(self):
2587cc
         MachineCase.setUp(self)
2587cc
@@ -135,17 +131,10 @@ class TestMultiMachineKeyAuth(MachineCase):
2587cc
         if m1.atomic_image:
2587cc
             self.load_key('id_rsa', 'foobar')
2587cc
             b.wait_js_cond('loaded === true');
2587cc
-            if self.use_md5(m1):
2587cc
-                self.check_keys([
2587cc
-                    "2048 93:40:9e:67:82:78:a8:99:89:39:d5:ba:e0:50:70:e1 id_rsa (RSA)"])
2587cc
-            else:
2587cc
-                self.check_keys([
2587cc
-                    "2048 SHA256:SRvBhCmkCEVnJ6ascVH0AoVEbS3nPbowZkNevJnXtgw id_rsa (RSA)"])
2587cc
-        elif self.use_md5(m1):
2587cc
-            self.check_keys(KEY_IDS_MD5)
2587cc
-        else:
2587cc
-            # Check our keys were loaded.
2587cc
-            self.check_keys(KEY_IDS)
2587cc
+            self.check_keys(["2048 93:40:9e:67:82:78:a8:99:89:39:d5:ba:e0:50:70:e1 id_rsa (RSA)"],
2587cc
+                            ["2048 SHA256:SRvBhCmkCEVnJ6ascVH0AoVEbS3nPbowZkNevJnXtgw id_rsa (RSA)"])
2587cc
+        # Check our keys were loaded.
2587cc
+        self.check_keys(KEY_IDS_MD5, KEY_IDS)
2587cc
 
2587cc
         # Add machine
2587cc
         b.switch_to_top()
2587cc
-- 
ce15b8
2.13.5
2587cc