diff options
author | Chris Anderson <chris.anderson@am.jll.com> | 2020-08-11 06:45:28 -0600 |
---|---|---|
committer | Chris Anderson <chris.anderson@am.jll.com> | 2020-08-11 06:45:28 -0600 |
commit | f5fd7f6a8be799cd97411b70378bc500809ef97c (patch) | |
tree | 96ab64fa432fc2abc1366df2bf856063fc004cb7 /tests | |
parent | 1b62d0d961e3f79dfdac706132d5cc9c81214771 (diff) | |
download | pysaml2-f5fd7f6a8be799cd97411b70378bc500809ef97c.tar.gz |
Ensure IdP configurations still default to NAME_FORMAT_URI
Diffstat (limited to 'tests')
-rw-r--r-- | tests/remote_data/InCommon-metadata-export.xml | 2 | ||||
-rw-r--r-- | tests/remote_data/metadata.aaitest.xml | 2 | ||||
-rw-r--r-- | tests/test_20_assertion.py | 18 |
3 files changed, 19 insertions, 3 deletions
diff --git a/tests/remote_data/InCommon-metadata-export.xml b/tests/remote_data/InCommon-metadata-export.xml index d67e6afa..5ac71b11 100644 --- a/tests/remote_data/InCommon-metadata-export.xml +++ b/tests/remote_data/InCommon-metadata-export.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><EntitiesDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:shibmd="urn:mace:shibboleth:metadata:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="_20191126T193752" validUntil="9999-01-01T00:00:00Z"> +<?xml version="1.0" encoding="UTF-8" standalone="no"?><EntitiesDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:shibmd="urn:mace:shibboleth:metadata:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="_20191126T193752" validUntil="3001-01-01T00:00:00Z"> <md:Extensions xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi"> <mdrpi:PublicationInfo creationInstant="2019-11-26T19:37:52Z" publisher="https://incommon.org"/> </md:Extensions> diff --git a/tests/remote_data/metadata.aaitest.xml b/tests/remote_data/metadata.aaitest.xml index 2c5b8824..6f1ec013 100644 --- a/tests/remote_data/metadata.aaitest.xml +++ b/tests/remote_data/metadata.aaitest.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><EntitiesDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui" xmlns:shibmd="urn:mace:shibboleth:metadata:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="AAITest-20191127170144" Name="urn:mace:switch.ch:aaitest" validUntil="9999-01-01T00:00:00Z" xsi:schemaLocation="urn:oasis:names:tc:SAML:2.0:metadata saml-schema-metadata-2.0.xsd urn:mace:shibboleth:metadata:1.0 shibboleth-metadata-1.0.xsd http://www.w3.org/2000/09/xmldsig# xmldsig-core-schema.xsd"> +<?xml version="1.0" encoding="UTF-8" standalone="no"?><EntitiesDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui" xmlns:shibmd="urn:mace:shibboleth:metadata:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="AAITest-20191127170144" Name="urn:mace:switch.ch:aaitest" validUntil="3001-01-01T00:00:00Z" xsi:schemaLocation="urn:oasis:names:tc:SAML:2.0:metadata saml-schema-metadata-2.0.xsd urn:mace:shibboleth:metadata:1.0 shibboleth-metadata-1.0.xsd http://www.w3.org/2000/09/xmldsig# xmldsig-core-schema.xsd"> <!-- This metadata file is generated for the AAI Test federation, which is for development and testing purposes only! diff --git a/tests/test_20_assertion.py b/tests/test_20_assertion.py index bb4dbb73..f617e516 100644 --- a/tests/test_20_assertion.py +++ b/tests/test_20_assertion.py @@ -2,11 +2,12 @@ from saml2.argtree import add_path from saml2.authn_context import pword from saml2.mdie import to_dict -from saml2 import md, assertion +from saml2 import md, assertion, create_class_from_xml_string from saml2.saml import Attribute from saml2.saml import Issuer from saml2.saml import NAMEID_FORMAT_ENTITY from saml2.saml import NAME_FORMAT_URI +from saml2.saml import NAME_FORMAT_UNSPECIFIED from saml2.saml import AttributeValue from saml2.saml import NameID from saml2.saml import NAMEID_FORMAT_TRANSIENT @@ -942,6 +943,21 @@ def test_assertion_with_authn_instant(): assert msg.authn_statement[0].authn_instant == "2009-02-13T23:31:30Z" +def test_attribute_producer_should_default_to_uri(): + attr = Attribute() + assert attr.name_format == NAME_FORMAT_URI + + +def test_attribute_consumer_should_default_to_unspecified(): + attr_str = """ + <saml:Attribute Name="uid" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <saml:AttributeValue xsi:type="xs:string">test</saml:AttributeValue> + </saml:Attribute> + """ + attr = create_class_from_xml_string(Attribute, attr_str) + assert attr.name_format == NAME_FORMAT_UNSPECIFIED + + if __name__ == "__main__": test_assertion_2() |