Skip to content

Commit

Permalink
added TestLDAPObject.test_errno107()
Browse files Browse the repository at this point in the history
  • Loading branch information
stroeder committed Apr 27, 2017
1 parent 0789a45 commit d92435d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Tests/t_ldapobject.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
test LDAP operations with Python wrapper module
test LDAP operations with ldap.ldapobject
"""

import os
Expand Down Expand Up @@ -35,7 +35,7 @@
"""


class TestSearch(SlapdTestCase):
class TestLDAPObject(SlapdTestCase):
"""
test LDAP search operations
"""
Expand Down Expand Up @@ -124,5 +124,20 @@ def test_search_oneattr(self):
[('cn=Foo4,ou=Container,'+self.server.suffix, {'cn': ['Foo4']})]
)

def test_errno107(self):
l = self.ldap_object_class('ldap://127.0.0.1:42')
try:
m = l.simple_bind_s("", "")
r = l.result4(m, ldap.MSG_ALL, self.timeout)
except ldap.SERVER_DOWN, ldap_err:
errno = ldap_err.args[0]['errno']
if errno != 107:
self.fail("expected errno=107, got %d" % errno)
info = ldap_err.args[0]['info']
if info != os.strerror(107):
self.fail("expected info=%r, got %d" % (os.strerror(107), info))
else:
self.fail("expected SERVER_DOWN, got %r" % r)

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

0 comments on commit d92435d

Please sign in to comment.