def setUp(self): """SetUp method is called for every testcase. We're stretching the boundaries here, because we create an account, thus making the setUp method a test in itself. Current parameters are consistent with a default LDAP server install with Apache Directory Studio on local machine. """ self.server = '127.0.0.1' self.bind_dn = 'uid=admin,ou=system' self.password = '******' self.search_base = 'ou=users,ou=system' self.ldap_port = 10389 self.ldaps_port = 10636 self.ldap = connect_to(self.server, self.bind_dn, self.password, protocol='ldaps', port=self.ldaps_port, verify=False, search_base=self.search_base) self.new_dn = 'cn=jdoe,' + self.search_base self.modlist = [ ('objectClass', ['top', 'inetOrgPerson']), ('givenName', ['John']), ('sn', ['Doe']), ] self.ldap.add(self.new_dn, self.modlist)
def test_anonymous_bind(self): ldap = connect_to(self.server, port=self.ldap_port) ldap.close()