Skip to content

Commit 28b753e

Browse files
committed
Add test for encrypted attributes
1 parent 59db3ca commit 28b753e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/src/OneLogin/saml2_tests/response_test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,23 @@ def testGetFriendlyAttributes(self):
756756
response_6 = OneLogin_Saml2_Response(settings, xml_5)
757757
self.assertEqual(expected_attributes, response_6.get_friendlyname_attributes())
758758

759+
def testGetEncryptedAttributes(self):
760+
"""
761+
Tests the get_attributes method of the OneLogin_Saml2_Response with an encrypted response
762+
"""
763+
settings = OneLogin_Saml2_Settings(self.loadSettingsJSON('settings8.json'))
764+
xml = self.file_contents(join(self.data_path, 'responses',
765+
'signed_message_encrypted_assertion2.xml.base64'))
766+
response = OneLogin_Saml2_Response(settings, xml)
767+
self.assertEqual({
768+
'uid': ['smartin'],
769+
'mail': ['smartin@yaco.es'],
770+
'cn': ['Sixto3'],
771+
'sn': ['Martin2'],
772+
'phone': [],
773+
'eduPersonAffiliation': ['user', 'admin'],
774+
}, response.get_attributes())
775+
759776
def testGetNestedNameIDAttributes(self):
760777
"""
761778
Tests the getAttributes method of the OneLogin_Saml2_Response with nested

0 commit comments

Comments
 (0)