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 7
7
8
8
from __future__ import unicode_literals
9
9
10
+ import errno
10
11
import os
11
12
import unittest
12
13
@@ -731,15 +732,16 @@ def test_cancel(self):
731
732
if not self ._require_attr (l , 'cancel' ): # FEATURE_CANCEL
732
733
return
733
734
734
- def test_errno107 (self ):
735
+ def test_enotconn (self ):
735
736
l = _ldap .initialize ('ldap://127.0.0.1:42' )
736
737
try :
737
738
m = l .simple_bind ("" , "" )
738
739
r = l .result4 (m , _ldap .MSG_ALL , self .timeout )
739
740
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 ))
743
745
else :
744
746
self .fail ("expected SERVER_DOWN, got %r" % r )
745
747
Original file line number Diff line number Diff line change 16
16
PY2 = False
17
17
text_type = str
18
18
19
+ import errno
19
20
import contextlib
20
21
import linecache
21
22
import os
@@ -451,18 +452,20 @@ def test_search_subschema_have_bytes(self):
451
452
]
452
453
)
453
454
454
- def test004_errno107 (self ):
455
+ def test004_enotconn (self ):
455
456
l = self .ldap_object_class ('ldap://127.0.0.1:42' )
456
457
try :
457
458
m = l .simple_bind_s ("" , "" )
458
459
r = l .result4 (m , ldap .MSG_ALL , self .timeout )
459
460
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 ))
463
465
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 ))
466
469
else :
467
470
self .fail ("expected SERVER_DOWN, got %r" % r )
468
471
You can’t perform that action at this time.
0 commit comments