Example #1
0
    def test_bind_both_invalid(self):
        d = self.createMergedServer(
            [[
                LDAPBindResponse(
                    resultCode=ldaperrors.LDAPInvalidCredentials.resultCode)
            ]],
            [[
                LDAPBindResponse(
                    resultCode=ldaperrors.LDAPInvalidCredentials.resultCode)
            ]],
        )

        def test_f(server):
            server.dataReceived(LDAPMessage(LDAPBindRequest(), id=4).toWire())
            self.assertEqual(
                server.transport.value(),
                LDAPMessage(
                    LDAPBindResponse(resultCode=ldaperrors.
                                     LDAPInvalidCredentials.resultCode),
                    id=4,
                ).toWire(),
            )

        d.addCallback(test_f)
        return d
Example #2
0
    def test_bind_both_success(self):
        d = self.createMergedServer([[LDAPBindResponse(resultCode=0)]],
                                    [[LDAPBindResponse(resultCode=0)]])

        def test_f(server):
            server.dataReceived(str(LDAPMessage(LDAPBindRequest(), id=4)))

            self.assertEquals(server.transport.value(),
                              str(LDAPMessage(LDAPBindResponse(resultCode=0), id=4)))

        d.addCallback(test_f)

        return d
Example #3
0
        def test_f(server):
            server.dataReceived(LDAPMessage(LDAPBindRequest(), id=4).toWire())

            self.assertEqual(
                server.transport.value(),
                LDAPMessage(LDAPBindResponse(resultCode=0), id=4).toWire(),
            )
Example #4
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)))