File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed
Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change 77
88from __future__ import unicode_literals
99
10+ import errno
1011import os
1112import unittest
1213
@@ -731,15 +732,16 @@ def test_cancel(self):
731732 if not self ._require_attr (l , 'cancel' ): # FEATURE_CANCEL
732733 return
733734
734- def test_errno107 (self ):
735+ def test_enotconn (self ):
735736 l = _ldap .initialize ('ldap://127.0.0.1:42' )
736737 try :
737738 m = l .simple_bind ("" , "" )
738739 r = l .result4 (m , _ldap .MSG_ALL , self .timeout )
739740 except _ldap .SERVER_DOWN as ldap_err :
740- errno = ldap_err .args [0 ]['errno' ]
741- if errno != 107 :
742- self .fail ("expected errno=107, got %d" % errno )
741+ errno_val = ldap_err .args [0 ]['errno' ]
742+ if errno_val != errno .ENOTCONN :
743+ self .fail ("expected errno=%d, got %d"
744+ % (errno .ENOTCONN , errno_val ))
743745 else :
744746 self .fail ("expected SERVER_DOWN, got %r" % r )
745747
Original file line number Diff line number Diff line change 1616 PY2 = False
1717 text_type = str
1818
19+ import errno
1920import contextlib
2021import linecache
2122import os
@@ -451,18 +452,20 @@ def test_search_subschema_have_bytes(self):
451452 ]
452453 )
453454
454- def test004_errno107 (self ):
455+ def test004_enotconn (self ):
455456 l = self .ldap_object_class ('ldap://127.0.0.1:42' )
456457 try :
457458 m = l .simple_bind_s ("" , "" )
458459 r = l .result4 (m , ldap .MSG_ALL , self .timeout )
459460 except ldap .SERVER_DOWN as ldap_err :
460- errno = ldap_err .args [0 ]['errno' ]
461- if errno != 107 :
462- self .fail ("expected errno=107, got %d" % errno )
461+ errno_val = ldap_err .args [0 ]['errno' ]
462+ if errno_val != errno .ENOTCONN :
463+ self .fail ("expected errno=%d, got %d"
464+ % (errno .ENOTCONN , errno_val ))
463465 info = ldap_err .args [0 ]['info' ]
464- if info != os .strerror (107 ):
465- self .fail ("expected info=%r, got %d" % (os .strerror (107 ), info ))
466+ expected_info = os .strerror (errno .ENOTCONN )
467+ if info != expected_info :
468+ self .fail ("expected info=%r, got %d" % (expected_info , info ))
466469 else :
467470 self .fail ("expected SERVER_DOWN, got %r" % r )
468471
You can’t perform that action at this time.
0 commit comments