From 89dfbab3ca076812590f371c21abcb51b350170b Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Feb 06 2017 13:59:46 +0000 Subject: tests: add test for PEM certificate files with leading text Reviewed-By: Christian Heimes --- 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 @@ class test_x509(object): 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)):