@@ -126,6 +126,8 @@ class Slapd:
126126
127127 :param root_pw: The root user password. The default value is `password`.
128128
129+ :param configuration_template: An optional inital database template.
130+
129131 :param datadir_prefix: The prefix of the temporary directory where the slapd
130132 configuration and data will be stored. The default value is `python-ldap-test`.
131133
@@ -157,6 +159,7 @@ def __init__(
157159 suffix = "dc=slapd-test,dc=python-ldap,dc=org" ,
158160 root_cn = "Manager" ,
159161 root_pw = "password" ,
162+ configuration_template = None ,
160163 datadir_prefix = None ,
161164 debug = None ,
162165 ):
@@ -178,6 +181,7 @@ def __init__(
178181 self ._slapd_conf = os .path .join (self .testrundir , "slapd.d" )
179182 self ._db_directory = os .path .join (self .testrundir , "openldap-data" )
180183 self .ldap_uri = "ldap://%s:%d/" % (self .host , self .port )
184+ self .configuration_template = configuration_template or SLAPD_CONF_TEMPLATE
181185 self .debug = debug
182186 have_ldapi = hasattr (socket , "AF_UNIX" )
183187 if have_ldapi :
@@ -307,7 +311,7 @@ def _gen_config(self):
307311 "servercert" : self .servercert ,
308312 "serverkey" : self .serverkey ,
309313 }
310- return SLAPD_CONF_TEMPLATE % config_dict
314+ return self . configuration_template % config_dict
311315
312316 def _write_config (self ):
313317 """Loads the slapd.d configuration."""
0 commit comments