def test_08_trimresult(self): ldap3mock.setLDAPDirectory(LDAPDirectory) y = LDAPResolver() y.loadConfig( { "LDAPURI": "ldap://localhost", "LDAPBASE": "o=test", "BINDDN": "cn=manager,ou=example,o=test", "BINDPW": "ldaptest", "LOGINNAMEATTRIBUTE": "cn", "LDAPSEARCHFILTER": "(cn=*)", "LDAPFILTER": "(&(cn=%s))", "USERINFO": '{ "username": "******",' '"phone" : "telephoneNumber", ' '"mobile" : "mobile"' ', "email" : "mail", ' '"surname" : "sn", ' '"givenname" : "givenName" }', "UIDTYPE": "oid", "NOREFERRALS": True, } ) r = y._trim_result( [ {"type": "searchResEntry", "DN": "blafoo"}, {"type": "searchResEntry", "DN": "foobar"}, {"type": "searchResRef", "info": "this is located on another LDAP"}, ] ) self.assertEqual(len(r), 2)
def test_08_trimresult(self): ldap3mock.setLDAPDirectory(LDAPDirectory) y = LDAPResolver() y.loadConfig({'LDAPURI': 'ldap://localhost', 'LDAPBASE': 'o=test', 'BINDDN': 'cn=manager,ou=example,o=test', 'BINDPW': 'ldaptest', 'LOGINNAMEATTRIBUTE': 'cn', 'LDAPSEARCHFILTER': '(cn=*)', 'LDAPFILTER': '(&(cn=%s))', 'USERINFO': '{ "username": "******",' '"phone" : "telephoneNumber", ' '"mobile" : "mobile"' ', "email" : "mail", ' '"surname" : "sn", ' '"givenname" : "givenName" }', 'UIDTYPE': 'oid', 'NOREFERRALS': True }) r = y._trim_result([{"type": "searchResEntry", "DN": "blafoo"}, {"type": "searchResEntry", "DN": "foobar"}, {"type": "searchResRef", "info": "this is located on another LDAP"}]) self.assertEqual(len(r), 2)
def test_08_trimresult(self): ldap3mock.setLDAPDirectory(LDAPDirectory) y = LDAPResolver() y.loadConfig({ 'LDAPURI': 'ldap://localhost', 'LDAPBASE': 'o=test', 'BINDDN': 'cn=manager,ou=example,o=test', 'BINDPW': 'ldaptest', 'LOGINNAMEATTRIBUTE': 'cn', 'LDAPSEARCHFILTER': '(cn=*)', 'LDAPFILTER': '(&(cn=%s))', 'USERINFO': '{ "username": "******",' '"phone" : "telephoneNumber", ' '"mobile" : "mobile"' ', "email" : "mail", ' '"surname" : "sn", ' '"givenname" : "givenName" }', 'UIDTYPE': 'oid', 'NOREFERRALS': True }) r = y._trim_result([{ "type": "searchResEntry", "DN": "blafoo" }, { "type": "searchResEntry", "DN": "foobar" }, { "type": "searchResRef", "info": "this is located on another LDAP" }]) self.assertEqual(len(r), 2)