Skip to content

Commit

Permalink
Test if reconnection is done after connection loss
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Best authored and Petr Viktorin committed Sep 20, 2019
1 parent da432d7 commit 689f7df
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Tests/t_ldapobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,23 @@ def test104_reconnect_restore(self):
l2 = pickle.loads(l1_state)
self.assertEqual(l2.whoami_s(), 'dn:'+bind_dn)

def test105_reconnect_restore(self):
l1 = self.ldap_object_class(self.server.ldap_uri, retry_max=2, retry_delay=1)
bind_dn = 'cn=user1,'+self.server.suffix
l1.simple_bind_s(bind_dn, 'user1_pw')
self.assertEqual(l1.whoami_s(), 'dn:'+bind_dn)
self.server._proc.terminate()
self.server.wait()
try:
l1.whoami_s()
except ldap.SERVER_DOWN:
pass
else:
self.assertEqual(True, False)
finally:
self.server._start_slapd()
self.assertEqual(l1.whoami_s(), 'dn:'+bind_dn)


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

0 comments on commit 689f7df

Please sign in to comment.