Test object implementing getaddrinfo.

Method __init__ Create a FakeAddrInfoGetter.
Method getaddrinfo Mock for socket.getaddrinfo.
Method addResultForHost Add a result for a given hostname. When this hostname is resolved, the result will be a list of all results addResultForHost has been called with using that hostname so far.
def __init__(self):

Create a FakeAddrInfoGetter.

def getaddrinfo(self, host, port, family=0, socktype=0, proto=0, flags=0):
def addResultForHost(self, host, sockaddr, family=AF_INET, socktype=SOCK_STREAM, proto=IPPROTO_TCP, canonname=''):

Add a result for a given hostname. When this hostname is resolved, the result will be a list of all results addResultForHost has been called with using that hostname so far.

ParametershostThe hostname to give this result for. This will be the next result from FakeAddrInfoGetter.getaddrinfo when passed this host.
sockaddrThe resulting socket address; should be a 2-tuple for IPv4 or a 4-tuple for IPv6.
familyAn AF_* constant that will be returned from getaddrinfo.
socktypeA SOCK_* constant that will be returned from getaddrinfo.
protoAn IPPROTO_* constant that will be returned from getaddrinfo.
canonnameA canonical name that will be returned from getaddrinfo. (type: native str)
API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.