Skip to content

Commit 3daa066

Browse files
committed
tests: check namespace processing
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent 5b09131 commit 3daa066

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_schema_validator.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
from pathutils import full_path as expand_full_path
2+
23
from pytest import mark
34
from pytest import raises
45

6+
from saml2 import create_class_from_xml_string
7+
from saml2.saml import AttributeStatement
8+
from saml2.sigver import validate_doc_with_schema
59
from saml2.xml.schema import XMLSchemaError
610
from saml2.xml.schema import validate as validate_doc_with_schema
711

@@ -86,3 +90,20 @@ def test_valid_saml_partial_doc(doc):
8690
def test_valid_eidas_saml_response_doc(doc):
8791
result = validate_doc_with_schema(expand_full_path(doc))
8892
assert result == None
93+
94+
95+
def test_namespace_processing():
96+
elem = create_class_from_xml_string(
97+
AttributeStatement,
98+
"""
99+
<saml:AttributeStatement xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
100+
<saml:Attribute Name="urn:mace:dir:attribute-def:uid" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
101+
<saml:AttributeValue xsi:type="xs:string">alum11</saml:AttributeValue>
102+
</saml:Attribute>
103+
<saml:Attribute Name="urn:mace:terena.org:attribute-def:schacHomeOrganization" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
104+
<saml:AttributeValue xsi:type="xs:string"/>
105+
</saml:Attribute>
106+
</saml:AttributeStatement>
107+
""",
108+
)
109+
validate_doc_with_schema(str(elem))

0 commit comments

Comments
 (0)