def test_get_roles_from_saml_doc(self): a = SAMLAuthenticator() a.xpath_role_location = '//saml:AttributeStatement/saml:Attribute[@Name="Roles"]/saml:AttributeValue/text()' assert self.sorted_roles == sorted( a._get_roles_from_saml_etree(self.verified_signed_xml)) assert self.sorted_roles == sorted( a._get_roles_from_saml_etree(self.response_etree)) assert self.sorted_roles == sorted( a._get_roles_from_saml_doc(self.verified_signed_xml, self.response_etree))
def test_get_roles_from_saml_doc(self): a = SAMLAuthenticator() a.xpath_role_location = '//saml:AttributeStatement/saml:Attribute[@Name="Roles"]/saml:AttributeValue/text()' assert ['Default' ] == a._get_roles_from_saml_etree(self.verified_signed_xml) assert ['Default'] == a._get_roles_from_saml_etree(self.response_etree) assert ['Default' ] == a._get_roles_from_saml_doc(self.verified_signed_xml, self.response_etree) a.xpath_role_location = '//saml:AttributeStatement/saml:Attribute[@Name="Bad_Role_Location"]/saml:AttributeValue/text()' assert a._get_roles_from_saml_etree(self.verified_signed_xml) == [] assert a._get_roles_from_saml_etree(self.response_etree) == [] assert a._get_roles_from_saml_doc(self.verified_signed_xml, self.response_etree) == []