URL: https://github.com/freeipa/freeipa/pull/436 Author: HonzaCholasta Title: #436: x509: allow leading text in PEM files Action: synchronized
To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/436/head:pr436 git checkout pr436
From 44717163aa56f7e920650831d83d69a1c3ee952c Mon Sep 17 00:00:00 2001 From: Jan Cholasta <jchol...@redhat.com> Date: Mon, 6 Feb 2017 13:16:11 +0100 Subject: [PATCH] tests: add test for PEM certificate files with leading text --- ipatests/test_ipalib/test_x509.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ipatests/test_ipalib/test_x509.py b/ipatests/test_ipalib/test_x509.py index 750e086..a3e6cda 100644 --- a/ipatests/test_ipalib/test_x509.py +++ b/ipatests/test_ipalib/test_x509.py @@ -69,6 +69,17 @@ def test_1_load_base64_cert(self): x509.load_certificate((newcert,)) x509.load_certificate([newcert]) + # Load a good cert with headers and leading text + newcert = ( + 'leading text\n-----BEGIN CERTIFICATE-----' + + goodcert + + '-----END CERTIFICATE-----') + x509.load_certificate(newcert) + + # Should handle list/tuple + x509.load_certificate((newcert,)) + x509.load_certificate([newcert]) + # Load a good cert with bad headers newcert = '-----BEGIN CERTIFICATE-----' + goodcert with pytest.raises((TypeError, ValueError)):
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code