@@ -126,6 +126,8 @@ class Slapd:
126
126
127
127
:param root_pw: The root user password. The default value is `password`.
128
128
129
+ :param configuration_template: An optional inital database template.
130
+
129
131
:param datadir_prefix: The prefix of the temporary directory where the slapd
130
132
configuration and data will be stored. The default value is `python-ldap-test`.
131
133
@@ -157,6 +159,7 @@ def __init__(
157
159
suffix = "dc=slapd-test,dc=python-ldap,dc=org" ,
158
160
root_cn = "Manager" ,
159
161
root_pw = "password" ,
162
+ configuration_template = None ,
160
163
datadir_prefix = None ,
161
164
debug = None ,
162
165
):
@@ -178,6 +181,7 @@ def __init__(
178
181
self ._slapd_conf = os .path .join (self .testrundir , "slapd.d" )
179
182
self ._db_directory = os .path .join (self .testrundir , "openldap-data" )
180
183
self .ldap_uri = "ldap://%s:%d/" % (self .host , self .port )
184
+ self .configuration_template = configuration_template or SLAPD_CONF_TEMPLATE
181
185
self .debug = debug
182
186
have_ldapi = hasattr (socket , "AF_UNIX" )
183
187
if have_ldapi :
@@ -307,7 +311,7 @@ def _gen_config(self):
307
311
"servercert" : self .servercert ,
308
312
"serverkey" : self .serverkey ,
309
313
}
310
- return SLAPD_CONF_TEMPLATE % config_dict
314
+ return self . configuration_template % config_dict
311
315
312
316
def _write_config (self ):
313
317
"""Loads the slapd.d configuration."""
0 commit comments