OPSI.ldaptor.testutil module

Utilities for writing Twistedy unit tests and debugging.

class OPSI.ldaptor.testutil.FakeTransport(proto)
loseConnection()
class OPSI.ldaptor.testutil.LDAPClientTestDriver(*responses)

A test driver that looks somewhat like a real LDAPClient.

Pass in a list of lists of LDAPProtocolResponses. For each sent LDAP message, the first item of said list is iterated through, and all the items are sent as responses to the callback. The sent LDAP messages are stored in self.sent, so you can assert that the sent messages are what they are supposed to be.

assertNothingSent()
assertSent(*shouldBeSent)
connectionLost(reason=None)

Called when TCP connection has been lost

connectionMade()

TCP connection has opened

send(op)
send_multiResponse(op, handler, *args, **kwargs)
send_noResponse(op)
unbind()
OPSI.ldaptor.testutil.calltrace()

Print out all function calls. For debug use only.

OPSI.ldaptor.testutil.createServer(proto, *responses, **kw)
OPSI.ldaptor.testutil.mustRaise(dummy)