summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Otto <nate@ottonomy.net>2020-07-04 12:36:35 -0700
committerNate Otto <nate@ottonomy.net>2020-07-04 12:36:35 -0700
commit4a568c964b5dc59f3620249ead45b5c75225346f (patch)
treeccac39cf8a1e9039f6c2d09f1a6b4c2f0a394013
parentd42e57ff22986c9c0780bc9b8eccb8d2c203376a (diff)
downloadpysaml2-4a568c964b5dc59f3620249ead45b5c75225346f.tar.gz
Add test for generation of signed metadata
-rw-r--r--tests/test_39_metadata.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/test_39_metadata.py b/tests/test_39_metadata.py
index a3796083..8ab6dfa5 100644
--- a/tests/test_39_metadata.py
+++ b/tests/test_39_metadata.py
@@ -1,7 +1,10 @@
import copy
from saml2.config import SPConfig
-from saml2.metadata import entity_descriptor
+from saml2.metadata import create_metadata_string, entity_descriptor
from saml2.saml import NAME_FORMAT_URI, NAME_FORMAT_BASIC
+from saml2 import sigver
+
+from pathutils import full_path
__author__ = 'roland'
@@ -47,5 +50,17 @@ def test_requested_attribute_name_format():
assert req_attr.name_format == NAME_FORMAT_BASIC
+def test_signed_metadata_proper_str_bytes_handling():
+ sp_conf_2 = sp_conf.copy()
+ sp_conf_2['key_file'] = full_path("test.key")
+ sp_conf_2['cert_file'] = full_path("inc-md-cert.pem")
+ # requires xmlsec binaries per https://pysaml2.readthedocs.io/en/latest/examples/sp.html
+ sp_conf_2['xmlsec_binary'] = sigver.get_xmlsec_binary(["/opt/local/bin"])
+ cnf = SPConfig().load(sp_conf_2, metadata_construction=True)
+
+ # This will raise TypeError if string/bytes handling is not correct
+ sp_metadata = create_metadata_string('', config=cnf, sign=True)
+
+
if __name__ == '__main__':
- test_requested_attribute_name_format() \ No newline at end of file
+ test_requested_attribute_name_format()