def test_auto_acquire_prop(self): """ Test auto_page_acquire property. """ client = LDAPClient(self.url) self.assertRaises(TypeError, lambda: client.set_auto_page_acquire("A")) self.assertTrue(client.auto_page_acquire) client.auto_page_acquire = False self.assertFalse(client.auto_page_acquire)
def _generate_client(cfg): url = "ldap://{host}:{port}/ou=nerdherd,{basedn}?{attr}?{scope}".format( host=cfg["SERVER"]["hostip"], port=cfg["SERVER"]["port"], basedn=cfg["SERVER"]["basedn"], attr=cfg["SERVER"]["search_attr"], scope=cfg["SERVER"]["search_scope"], ) client = LDAPClient(url) client.set_credentials("SIMPLE", user=cfg["SIMPLEAUTH"]["user"], password=cfg["SIMPLEAUTH"]["password"]) client.auto_page_acquire = False return client
def _generate_client(cfg): url = "ldap://{host}:{port}/ou=nerdherd,{basedn}?{attr}?{scope}".format( host=cfg["SERVER"]["hostip"], port=cfg["SERVER"]["port"], basedn=cfg["SERVER"]["basedn"], attr=cfg["SERVER"]["search_attr"], scope=cfg["SERVER"]["search_scope"], ) client = LDAPClient(url) client.set_credentials( "SIMPLE", user=cfg["SIMPLEAUTH"]["user"], password=cfg["SIMPLEAUTH"]["password"] ) client.auto_page_acquire = False return client
def setUp(self): """ Set LDAP URL and open connection. """ curdir = os.path.abspath(os.path.dirname(__file__)) self.cfg = configparser.ConfigParser() self.cfg.read(os.path.join(curdir, 'test.ini')) self.ipaddr = self.cfg["SERVER"]["hostip"] self.url = "ldap://%s:%s/ou=nerdherd,%s?%s?%s" % \ (self.cfg["SERVER"]["hostip"], self.cfg["SERVER"]["port"], self.cfg["SERVER"]["basedn"], self.cfg["SERVER"]["search_attr"], self.cfg["SERVER"]["search_scope"]) self.host = "ldap://%s" % self.cfg['SERVER']['hostname'] self.basedn = self.cfg["SERVER"]["basedn"] client = LDAPClient(self.url) client.set_credentials("SIMPLE", (self.cfg["SIMPLEAUTH"]["user"], self.cfg["SIMPLEAUTH"]["password"])) client.auto_page_acquire = False self.conn = client.connect() self.async_conn = LDAPConnection(client, True)