#NEWLINE# def test_bind_match_badAuth( self ) : #NEWLINE# #INDENT# server = self . createServer ( services = [ 'svc1' , 'svc2' , 'svc3' ] , fallback = True , responses = [ [ pureldap . LDAPSearchResultEntry ( 'cn=svc1+owner=cn\\=jack\\,dc\\=example\\,dc\\=com,dc=example,dc=com' , attributes = [ ] ) , pureldap . LDAPSearchResultDone ( ldaperrors . Success . resultCode ) ] , [ pureldap . LDAPBindResponse ( resultCode = ldaperrors . LDAPInvalidCredentials . resultCode ) ] , [ pureldap . LDAPSearchResultDone ( ldaperrors . Success . resultCode ) ] , [ pureldap . LDAPSearchResultEntry ( 'cn=svc3+owner=cn\\=jack\\,dc\\=example\\,dc\\=com,dc=example,dc=com' , attributes = [ ] ) , pureldap . LDAPSearchResultDone ( ldaperrors . Success . resultCode ) ] , [ pureldap . LDAPBindResponse ( resultCode = ldaperrors . LDAPInvalidCredentials . resultCode ) ] , [ pureldap . LDAPBindResponse ( resultCode = ldaperrors . LDAPInvalidCredentials . resultCode ) ] ] ) #NEWLINE# server . dataReceived ( str ( pureldap . LDAPMessage ( pureldap . LDAPBindRequest ( dn = 'cn=jack,dc=example,dc=com' , auth = 'wrong-s3krit' ) , id = 4 ) ) ) #NEWLINE# reactor . iterate ( ) #NEWLINE# client = server . client #NEWLINE# client . assertSent ( pureldap . LDAPSearchRequest ( baseObject = 'dc=example,dc=com' , derefAliases = 0 , sizeLimit = 0 , timeLimit = 0 , typesOnly = 0 , filter = ldapfilter . parseFilter ( ( ( ( ( ( ( '(&' + '(objectClass=serviceSecurityObject)' ) + '(owner=cn=jack,dc=example,dc=com)' ) + '(cn=svc1)' ) + ( '(|(!(validFrom=*))(validFrom<=%s))' % server . now ) ) + ( '(|(!(validUntil=*))(validUntil>=%s))' % server . now ) ) + ')' ) ) , attributes = ( '1.1' , ) ) , pureldap . LDAPBindRequest ( dn = 'cn=svc1+owner=cn\\=jack\\,dc\\=example\\,dc\\=com,dc=example,dc=com' , auth = 'wrong-s3krit' ) , pureldap . LDAPSearchRequest ( baseObject = 'dc=example,dc=com' , derefAliases = 0 , sizeLimit = 0 , timeLimit = 0 , typesOnly = 0 , filter = ldapfilter . parseFilter ( ( ( ( ( ( ( '(&' + '(objectClass=serviceSecurityObject)' ) + '(owner=cn=jack,dc=example,dc=com)' ) + '(cn=svc2)' ) + ( '(|(!(validFrom=*))(validFrom<=%s))' % server . now ) ) + ( '(|(!(validUntil=*))(validUntil>=%s))' % server . now ) ) + ')' ) ) , attributes = ( '1.1' , ) ) , pureldap . LDAPSearchRequest ( baseObject = 'dc=example,dc=com' , derefAliases = 0 , sizeLimit = 0 , timeLimit = 0 , typesOnly = 0 , filter = ldapfilter . parseFilter ( ( ( ( ( ( ( '(&' + '(objectClass=serviceSecurityObject)' ) + '(owner=cn=jack,dc=example,dc=com)' ) + '(cn=svc3)' ) + ( '(|(!(validFrom=*))(validFrom<=%s))' % server . now ) ) + ( '(|(!(validUntil=*))(validUntil>=%s))' % server . now ) ) + ')' ) ) , attributes = ( '1.1' , ) ) , pureldap . LDAPBindRequest ( dn = 'cn=svc3+owner=cn\\=jack\\,dc\\=example\\,dc\\=com,dc=example,dc=com' , auth = 'wrong-s3krit' ) , pureldap . LDAPBindRequest ( version = 3 , dn = 'cn=jack,dc=example,dc=com' , auth = 'wrong-s3krit' ) ) #NEWLINE# self . assertEquals ( server . transport . value ( ) , str ( pureldap . LDAPMessage ( pureldap . LDAPBindResponse ( resultCode = ldaperrors . LDAPInvalidCredentials . resultCode ) , id = 4 ) ) )