Skip to content

Commit

Permalink
Removed method SlapdObject.started()
Browse files Browse the repository at this point in the history
  • Loading branch information
stroeder committed Apr 28, 2017
1 parent 900d328 commit 3178479
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
6 changes: 4 additions & 2 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ Lib/slapdtest.py
in methods ldapadd() and ldapwhoami()
* added method slaptest.SlapdObject.ldapmodify()
* fixed enabling logger in slaptest
* directory name now contains port to be able to run several SlapdObject
* directory name now contains port to be able to run several SlapdObject
instances side-by-side (e.g. with replication)
* added authz-regexp mapping to rootdn for user running the test
* internally use SASL/EXTERNAL via LDAPI to bind
* SlapdObject.server_id used as serverID in slapd.conf for MMR
* Removed method SlapdObject.started() because SlapdTestCase.setUpClass()
will be used to add initial entries

Tests/
* ReconnectLDAPObject is also tested by sub-classing test class
Expand Down Expand Up @@ -1430,4 +1432,4 @@ Released 2.0.0pre02 2002-02-01
----------------------------------------------------------------
Released 1.10alpha3 2000-09-19

$Id: CHANGES,v 1.441 2017/04/27 16:45:19 stroeder Exp $
$Id: CHANGES,v 1.442 2017/04/28 06:21:04 stroeder Exp $
25 changes: 25 additions & 0 deletions Tests/t_cext.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,31 @@ class TestLdapCExtension(SlapdTestCase):

timeout = 5

@classmethod
def setUpClass(cls):
SlapdTestCase.setUpClass()
# add two initial objects after server was started and is still empty
suffix_dc = cls.server.suffix.split(',')[0][3:]
cls.server._log.debug(
"adding %s and %s",
cls.server.suffix,
cls.server.root_dn,
)
cls.server.ldapadd(
"\n".join([
'dn: '+cls.server.suffix,
'objectClass: dcObject',
'objectClass: organization',
'dc: '+suffix_dc,
'o: '+suffix_dc,
'',
'dn: '+cls.server.root_dn,
'objectClass: applicationProcess',
'cn: '+cls.server.root_cn,
''
])
)

def _open_conn(self, bind=True):
"""
Starts a server, and returns a LDAPObject bound to it
Expand Down
24 changes: 22 additions & 2 deletions Tests/t_ldapobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@
import ldap
from ldap.ldapobject import SimpleLDAPObject, ReconnectLDAPObject

LDIF_TEMPLATE = """dn: cn=Foo1,%(suffix)s
LDIF_TEMPLATE = """dn: %(suffix)s
objectClass: dcObject
objectClass: organization
dc: %(dc)s
o: %(dc)s
dn: %(rootdn)s
objectClass: applicationProcess
objectClass: simpleSecurityObject
cn: %(rootcn)s
userPassword: %(rootpw)s
dn: cn=Foo1,%(suffix)s
objectClass: organizationalRole
cn: Foo1
Expand Down Expand Up @@ -46,7 +58,15 @@ class Test01_SimpleLDAPObject(SlapdTestCase):
def setUpClass(cls):
SlapdTestCase.setUpClass()
# insert some Foo* objects via ldapadd
cls.server.ldapadd(LDIF_TEMPLATE % {'suffix':cls.server.suffix})
cls.server.ldapadd(
LDIF_TEMPLATE % {
'suffix':cls.server.suffix,
'rootdn':cls.server.root_dn,
'rootcn':cls.server.root_cn,
'rootpw':cls.server.root_pw,
'dc': cls.server.suffix.split(',')[0][3:],
}
)

def setUp(self):
try:
Expand Down

0 comments on commit 3178479

Please sign in to comment.