Skip to content

Commit d534a46

Browse files
author
stroeder
committed
added explicit reconnect tests for ReconnectLDAPObject
1 parent 0829d52 commit d534a46

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

CHANGES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Lib/
88
without cleaning any data
99

1010
Tests/
11-
*
11+
* added explicit reconnect tests for ReconnectLDAPObject
1212

1313
----------------------------------------------------------------
1414
Released 2.4.45 2017-10-09

Tests/t_ldapobject.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
cn: %(rootcn)s
2828
userPassword: %(rootpw)s
2929
30+
dn: cn=user1,%(suffix)s
31+
objectClass: applicationProcess
32+
objectClass: simpleSecurityObject
33+
cn: user1
34+
userPassword: user1_pw
35+
3036
dn: cn=Foo1,%(suffix)s
3137
objectClass: organizationalRole
3238
cn: Foo1
@@ -190,6 +196,22 @@ class Test02_ReconnectLDAPObject(Test01_SimpleLDAPObject):
190196

191197
ldap_object_class = ReconnectLDAPObject
192198

199+
def test_reconnect_sasl_external(self):
200+
l = self.ldap_object_class(self.server.ldapi_uri)
201+
l.sasl_external_bind_s()
202+
authz_id = l.whoami_s()
203+
self.assertEqual(authz_id, 'dn:'+self.server.root_dn.lower())
204+
self.server.restart()
205+
self.assertEqual(l.whoami_s(), authz_id)
206+
207+
def test_reconnect_simple_bind(self):
208+
l = self.ldap_object_class(self.server.ldapi_uri)
209+
bind_dn = 'cn=user1,'+self.server.suffix
210+
l.simple_bind_s(bind_dn, 'user1_pw')
211+
self.assertEqual(l.whoami_s(), 'dn:'+bind_dn)
212+
self.server.restart()
213+
self.assertEqual(l.whoami_s(), 'dn:'+bind_dn)
214+
193215

194216
if __name__ == '__main__':
195217
unittest.main()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy