示例#1
0
        def test_f(server):
            server.dataReceived(LDAPMessage(LDAPBindRequest(), id=4).toWire())

            self.assertEqual(
                server.transport.value(),
                LDAPMessage(LDAPBindResponse(resultCode=0), id=4).toWire(),
            )
示例#2
0
 def test_f(server):
     server.dataReceived(str(LDAPMessage(LDAPBindRequest(), id=4)))
     self.assertEqual(
         server.transport.value(),
         str(
             LDAPMessage(
                 LDAPBindResponse(resultCode=ldaperrors.
                                  LDAPInvalidCredentials.resultCode),
                 id=4)))
示例#3
0
 def test_f(server):
     server.dataReceived(str(LDAPMessage(LDAPSearchRequest(), id=3)))
     self.assertEqual(
         server.transport.value(),
         str(
             LDAPMessage(LDAPSearchResultEntry(
                 'cn=foo,dc=example,dc=com', [('a', ['b'])]),
                         id=3)) +
         str(
             LDAPMessage(LDAPSearchResultEntry(
                 'cn=bar,dc=example,dc=com', [('b', ['c'])]),
                         id=3)) + str(
                             LDAPMessage(LDAPSearchResultDone(
                                 ldaperrors.Success.resultCode),
                                         id=3)))
示例#4
0
 def test_f(server):
     server.dataReceived(
         LDAPMessage(LDAPUnbindRequest(), id=3).toWire())
     server.connectionLost(error.ConnectionDone)
     for c in self.clients:
         c.assertSent(LDAPUnbindRequest())
     self.assertEqual(server.transport.value(), b"")
示例#5
0
        def test_f(server):
            server.dataReceived(str(LDAPMessage(LDAPAddRequest(entry="", attributes=[]), id=3)))
            server.dataReceived(str(LDAPMessage(LDAPDelRequest(entry=""), id=4)))
            server.dataReceived(str(LDAPMessage(LDAPModifyRequest(object="", modification=[]), id=5)))
            server.dataReceived(str(LDAPMessage(LDAPModifyDNRequest(entry="", newrdn="", deleteoldrdn=0), id=6)))
            server.dataReceived(str(LDAPMessage(LDAPExtendedRequest(requestName=""), id=7)))
            for c in server.clients:
                c.assertNothingSent()

            self.assertEquals(server.transport.value(),
                              str(LDAPMessage(LDAPAddResponse(resultCode=ldaperrors.LDAPUnwillingToPerform.resultCode), id=3))
                              +str(LDAPMessage(LDAPDelResponse(resultCode=ldaperrors.LDAPUnwillingToPerform.resultCode), id=4))
                              +str(LDAPMessage(LDAPModifyResponse(resultCode=ldaperrors.LDAPUnwillingToPerform.resultCode), id=5))
                              +str(LDAPMessage(LDAPModifyDNResponse(resultCode=ldaperrors.LDAPUnwillingToPerform.resultCode), id=6))
                              +str(LDAPMessage(LDAPExtendedResponse(resultCode=ldaperrors.LDAPUnwillingToPerform.resultCode), id=7))
                              )
示例#6
0
 def test_f(server):
     server.dataReceived(
         LDAPMessage(LDAPSearchRequest(), id=3).toWire())
     self.assertEqual(
         server.transport.value(),
         LDAPMessage(
             LDAPSearchResultEntry("cn=foo,dc=example,dc=com",
                                   [("a", ["b"])]),
             id=3,
         ).toWire() + LDAPMessage(
             LDAPSearchResultEntry("cn=bar,dc=example,dc=com",
                                   [("b", ["c"])]),
             id=3,
         ).toWire() + LDAPMessage(LDAPSearchResultDone(
             ldaperrors.Success.resultCode),
                                  id=3).toWire(),
     )