@@ -656,7 +656,7 @@ def testGetSessionIndex(self):
656656
657657 def testGetAttributes (self ):
658658 """
659- Tests the getAttributes method of the OneLogin_Saml2_Response
659+ Tests the get_attributes method of the OneLogin_Saml2_Response
660660 """
661661 settings = OneLogin_Saml2_Settings (self .loadSettingsJSON ())
662662 xml = self .file_contents (join (self .data_path , 'responses' , 'response1.xml.base64' ))
@@ -678,6 +678,30 @@ def testGetAttributes(self):
678678 response_3 = OneLogin_Saml2_Response (settings , xml_3 )
679679 self .assertEqual ({}, response_3 .get_attributes ())
680680
681+ def testGetFriendlyAttributes (self ):
682+ """
683+ Tests the get_friendlyname_attributes method of the OneLogin_Saml2_Response
684+ """
685+ settings = OneLogin_Saml2_Settings (self .loadSettingsJSON ())
686+ xml = self .file_contents (join (self .data_path , 'responses' , 'response1.xml.base64' ))
687+ response = OneLogin_Saml2_Response (settings , xml )
688+ self .assertEqual ({}, response .get_friendlyname_attributes ())
689+
690+ expected_attributes = {
691+ 'username' : ['demo' ]
692+ }
693+ xml_2 = self .file_contents (join (self .data_path , 'responses' , 'response1_with_friendlyname.xml.base64' ))
694+ response_2 = OneLogin_Saml2_Response (settings , xml_2 )
695+ self .assertEqual (expected_attributes , response_2 .get_friendlyname_attributes ())
696+
697+ xml_3 = self .file_contents (join (self .data_path , 'responses' , 'response2.xml.base64' ))
698+ response_3 = OneLogin_Saml2_Response (settings , xml_3 )
699+ self .assertEqual ({}, response_3 .get_friendlyname_attributes ())
700+
701+ xml_4 = self .file_contents (join (self .data_path , 'responses' , 'invalids' , 'encrypted_attrs.xml.base64' ))
702+ response_4 = OneLogin_Saml2_Response (settings , xml_4 )
703+ self .assertEqual ({}, response_4 .get_friendlyname_attributes ())
704+
681705 def testGetNestedNameIDAttributes (self ):
682706 """
683707 Tests the getAttributes method of the OneLogin_Saml2_Response with nested
0 commit comments