From e712e5b8791af0ce498f536b21283412e4459dee Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Thu, 6 Dec 2012 16:43:53 +0100 Subject: [PATCH] Fix node-daemon-setup test with older pyOpenSSL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Older versions use β-----BEGIN RSA PRIVATE KEY-----β instead of β-----BEGIN PRIVATE KEY-----β. Signed-off-by: Michael Hanselmann <hansmi@google.com> Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- test/ganeti.tools.node_daemon_setup_unittest.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/ganeti.tools.node_daemon_setup_unittest.py b/test/ganeti.tools.node_daemon_setup_unittest.py index dc05fe045..da06d7ea6 100755 --- a/test/ganeti.tools.node_daemon_setup_unittest.py +++ b/test/ganeti.tools.node_daemon_setup_unittest.py @@ -101,8 +101,12 @@ class TestVerifyCertificate(testutils.GanetiTestCase): cert_pem = utils.ReadFile(cert_filename) result = \ node_daemon_setup._VerifyCertificate(cert_pem, _check_fn=self._Check) - self.assertTrue("-----BEGIN PRIVATE KEY-----" in result) - self.assertTrue("-----BEGIN CERTIFICATE-----" in result) + + cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, result) + self.assertTrue(cert) + + key = OpenSSL.crypto.load_privatekey(OpenSSL.crypto.FILETYPE_PEM, result) + self.assertTrue(key) def testMismatchingKey(self): cert1_path = self._TestDataFilename("cert1.pem") -- GitLab