diff options
author | Jan Cholasta <jcholast@redhat.com> | 2017-02-06 13:16:11 +0100 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2017-02-06 14:59:46 +0100 |
commit | 89dfbab3ca076812590f371c21abcb51b350170b (patch) | |
tree | 8b11c08631651d4f8d8c5c31a19d29b1676e80d2 | |
parent | 066f5b7c904208d0fd79862dfaa7166fff42fd30 (diff) | |
download | freeipa-89dfbab3ca076812590f371c21abcb51b350170b.tar.gz freeipa-89dfbab3ca076812590f371c21abcb51b350170b.tar.xz freeipa-89dfbab3ca076812590f371c21abcb51b350170b.zip |
tests: add test for PEM certificate files with leading text
Reviewed-By: Christian Heimes <cheimes@redhat.com>
-rw-r--r-- | ipatests/test_ipalib/test_x509.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ipatests/test_ipalib/test_x509.py b/ipatests/test_ipalib/test_x509.py index 750e086e4..a3e6cda3d 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)): |