diff options
Diffstat (limited to 'tests/test_40_sigver.py')
-rw-r--r-- | tests/test_40_sigver.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/test_40_sigver.py b/tests/test_40_sigver.py index 87a785a1..e5225855 100644 --- a/tests/test_40_sigver.py +++ b/tests/test_40_sigver.py @@ -9,10 +9,11 @@ from saml2 import class_name from saml2 import time_util from saml2 import saml, samlp from saml2 import config +from saml2.cert import read_cert_from_file +from saml2.cert import CertificateError from saml2.sigver import pre_encryption_part from saml2.sigver import make_temp from saml2.sigver import XmlsecError -from saml2.sigver import SigverError from saml2.mdstore import MetadataStore from saml2.saml import assertion_from_string from saml2.saml import EncryptedAssertion @@ -97,8 +98,7 @@ def test_cert_from_instance_1(): assert certs[0] == CERT1 -@pytest.mark.skipif(not decoder, - reason="pyasn1 is not installed") +@pytest.mark.skipif(not decoder, reason="pyasn1 is not installed") def test_cert_from_instance_ssp(): with open(SIMPLE_SAML_PHP_RESPONSE) as fp: xml_response = fp.read() @@ -1114,6 +1114,21 @@ def test_xmlsec_output_line_parsing(): sigver.parse_xmlsec_output(output4) +def test_cert_trailing_newlines_ignored(): + assert read_cert_from_file(full_path("extra_lines.crt")) \ + == read_cert_from_file(full_path("test_2.crt")) + + +def test_invalid_cert_raises_error(): + with raises(CertificateError): + read_cert_from_file(full_path("malformed.crt")) + + +def test_der_certificate_loading(): + assert read_cert_from_file(full_path("test_1.der"), "der") == \ + read_cert_from_file(full_path("test_1.crt")) + + if __name__ == "__main__": # t = TestSecurity() # t.setup_class() |