diff options
author | Damien Laniel <dlaniel@entrouvert.com> | 2008-01-14 11:20:16 +0000 |
---|---|---|
committer | Damien Laniel <dlaniel@entrouvert.com> | 2008-01-14 11:20:16 +0000 |
commit | 53a2b18539d70a49a94b36616b16cf05a06d273c (patch) | |
tree | 475b4fd363a0c1cab0f2e5b4124a703bf653452b /python/tests/binding_tests.py | |
parent | ee439f13f2c0ef127f7d27922b6d21952bf92070 (diff) | |
download | lasso-53a2b18539d70a49a94b36616b16cf05a06d273c.tar.gz lasso-53a2b18539d70a49a94b36616b16cf05a06d273c.tar.xz lasso-53a2b18539d70a49a94b36616b16cf05a06d273c.zip |
added swig binding for Saml2AttributeValue + tests
Diffstat (limited to 'python/tests/binding_tests.py')
-rwxr-xr-x | python/tests/binding_tests.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/python/tests/binding_tests.py b/python/tests/binding_tests.py index 8e9e0b29..8ac44c40 100755 --- a/python/tests/binding_tests.py +++ b/python/tests/binding_tests.py @@ -238,6 +238,73 @@ class BindingTestCase(unittest.TestCase): del login + def test07(self): + """Get & set SAML 2.0 assertion attribute values""" + + attribute1_name = 'first attribute' + attribute1_string = 'first string' + attribute2_name = 'second attribute' + attribute2_string = 'second string' + attribute3_string = 'third string' + + expected_assertion_dump = '''\ +<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" SignType="0" SignMethod="0" EncryptionActivated="false" EncryptionSymKeyType="0"> + <saml:AttributeStatement> + <saml:Attribute Name="first attribute"> + <saml:AttributeValue> + <XXX>first string</XXX> + </saml:AttributeValue> + </saml:Attribute> + <saml:Attribute Name="second attribute"> + <saml:AttributeValue> + <XXX>second string</XXX> + <XXX>third string</XXX> + </saml:AttributeValue> + </saml:Attribute> + </saml:AttributeStatement> +</saml:Assertion>''' + + text_node1 = lasso.MiscTextNode() + text_node1.content = attribute1_string + any1 = lasso.NodeList() + any1.append(text_node1) + attribute_value1 = lasso.Saml2AttributeValue() + attribute_value1.any = any1 + attribute_values1 = lasso.NodeList() + attribute_values1.append(attribute_value1) + attribute1 = lasso.Saml2Attribute() + attribute1.name = attribute1_name + attribute1.attributeValue = attribute_values1 + + text_node2 = lasso.MiscTextNode() + text_node2.content = attribute2_string + text_node3 = lasso.MiscTextNode() + text_node3.content = attribute3_string + any1 = lasso.NodeList() + any1.append(text_node2) + any1.append(text_node3) + attribute_value2 = lasso.Saml2AttributeValue() + attribute_value2.any = any1 + attribute_values2 = lasso.NodeList() + attribute_values2.append(attribute_value2) + attribute2 = lasso.Saml2Attribute() + attribute2.name = attribute2_name + attribute2.attributeValue = attribute_values2 + + attributes = lasso.NodeList() + attributes.append(attribute1) + attributes.append(attribute2) + + attributeStatement = lasso.Saml2AttributeStatement() + attributeStatement.attribute = attributes + attributeStatements = lasso.NodeList() + attributeStatements.append(attributeStatement) + + assertion = lasso.Saml2Assertion() + assertion.attributeStatement = attributeStatements + + self.failUnlessEqual(assertion.dump(), expected_assertion_dump, 'resulting assertion dump is not as expected') + bindingSuite = unittest.makeSuite(BindingTestCase, 'test') |