From e712e5b8791af0ce498f536b21283412e4459dee Mon Sep 17 00:00:00 2001 From: Michael Hanselmann 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=utf8 Content-Transfer-Encoding: 8bit Older versions use “-----BEGIN RSA PRIVATE KEY-----” instead of “-----BEGIN PRIVATE KEY-----”. Signed-off-by: Michael Hanselmann Signed-off-by: Guido Trotter Reviewed-by: Guido Trotter --- 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 dc05fe0..da06d7e 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") -- 1.7.10.4