tldap.test package#

Submodules#

tldap.test.slapd module#

Utilities for starting up a test slapd server and talking to it with ldapsearch/ldapadd.

class tldap.test.slapd.Slapd[source]#

Bases: object

Controller class for a slapd instance, OpenLDAP’s server.

This class creates a temporary data store for slapd, runs it on a private port, and initialises it with a top-level dc and the root user.

When a reference to an instance of this class is lost, the slapd server is shut down.

PATH_LDAPADD = 'ldapadd'#
PATH_LDAPSEARCH = 'ldapsearch'#
PATH_SCHEMA_DIR = '/home/docs/checkouts/readthedocs.org/user_builds/python-tldap/checkouts/stable/tldap/test/ldap_schemas/'#
PATH_SLAPD = 'slapd'#
PATH_SLAP_TEST = 'slaptest'#
TEST_UTILS_DIR = '/home/docs/checkouts/readthedocs.org/user_builds/python-tldap/checkouts/stable/tldap/test'#
get_address() Tuple[str, int][source]#
get_dn_suffix() str[source]#
get_root_dn() str[source]#
get_root_password() str[source]#
get_url() str[source]#
ldap_add(ldif: str, extra_args: List | None = None) None[source]#

Runs ldapadd on this slapd instance, passing it the ldif content

restart() None[source]#

Restarts the slapd server; ERASING previous content. Starts the server even it if isn’t already running.

set_debug() None[source]#
set_dn_suffix(dn: str) None[source]#
set_port(port: int) None[source]#
set_root_cn(cn: str) None[source]#
set_root_password(pw: str) None[source]#
set_slapd_debug_level(level: int) None[source]#
start() None[source]#

Starts the slapd server process running, and waits for it to come up.

stop() None[source]#

Stops the slapd server, and waits for it to terminate

wait() None[source]#

Waits for the slapd process to terminate by itself.

tldap.test.slapd.delete_directory_content(path: str) None[source]#
tldap.test.slapd.find_available_tcp_port(host: str = '127.0.0.1') int[source]#
tldap.test.slapd.is_port_in_use(port: int, host: str = '127.0.0.1') bool[source]#
tldap.test.slapd.mkdirs(path: str) str[source]#

Creates the directory path unless it already exists

tldap.test.slapd.quote(s: str) str[source]#

Quotes the ‘”’ and ‘’ characters in a string and surrounds with “…”

tldap.test.slapd.test() None[source]#

Module contents#