From 28b753e9a7ee1da78801170791e0a9724014f360 Mon Sep 17 00:00:00 2001 From: Sixto Martin Date: Mon, 9 Oct 2023 11:18:53 +0200 Subject: [PATCH] Add test for encrypted attributes --- tests/src/OneLogin/saml2_tests/response_test.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/src/OneLogin/saml2_tests/response_test.py b/tests/src/OneLogin/saml2_tests/response_test.py index a8eae7d8..43921135 100644 --- a/tests/src/OneLogin/saml2_tests/response_test.py +++ b/tests/src/OneLogin/saml2_tests/response_test.py @@ -756,6 +756,23 @@ def testGetFriendlyAttributes(self): response_6 = OneLogin_Saml2_Response(settings, xml_5) self.assertEqual(expected_attributes, response_6.get_friendlyname_attributes()) + def testGetEncryptedAttributes(self): + """ + Tests the get_attributes method of the OneLogin_Saml2_Response with an encrypted response + """ + settings = OneLogin_Saml2_Settings(self.loadSettingsJSON('settings8.json')) + xml = self.file_contents(join(self.data_path, 'responses', + 'signed_message_encrypted_assertion2.xml.base64')) + response = OneLogin_Saml2_Response(settings, xml) + self.assertEqual({ + 'uid': ['smartin'], + 'mail': ['smartin@yaco.es'], + 'cn': ['Sixto3'], + 'sn': ['Martin2'], + 'phone': [], + 'eduPersonAffiliation': ['user', 'admin'], + }, response.get_attributes()) + def testGetNestedNameIDAttributes(self): """ Tests the getAttributes method of the OneLogin_Saml2_Response with nested