File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 1
1
import copy
2
2
from saml2 .config import SPConfig
3
- from saml2 .metadata import entity_descriptor
3
+ from saml2 .metadata import create_metadata_string , entity_descriptor
4
4
from saml2 .saml import NAME_FORMAT_URI , NAME_FORMAT_BASIC
5
+ from saml2 import sigver
6
+
7
+ from pathutils import full_path
5
8
6
9
__author__ = 'roland'
7
10
@@ -47,5 +50,17 @@ def test_requested_attribute_name_format():
47
50
assert req_attr .name_format == NAME_FORMAT_BASIC
48
51
49
52
53
+ def test_signed_metadata_proper_str_bytes_handling ():
54
+ sp_conf_2 = sp_conf .copy ()
55
+ sp_conf_2 ['key_file' ] = full_path ("test.key" )
56
+ sp_conf_2 ['cert_file' ] = full_path ("inc-md-cert.pem" )
57
+ # requires xmlsec binaries per https://pysaml2.readthedocs.io/en/latest/examples/sp.html
58
+ sp_conf_2 ['xmlsec_binary' ] = sigver .get_xmlsec_binary (["/opt/local/bin" ])
59
+ cnf = SPConfig ().load (sp_conf_2 , metadata_construction = True )
60
+
61
+ # This will raise TypeError if string/bytes handling is not correct
62
+ sp_metadata = create_metadata_string ('' , config = cnf , sign = True )
63
+
64
+
50
65
if __name__ == '__main__' :
51
- test_requested_attribute_name_format ()
66
+ test_requested_attribute_name_format ()
You can’t perform that action at this time.
0 commit comments