class documentation
class FakeAddrInfoGetter: (source)
Test object implementing getaddrinfo.
Method | __init__ |
Create a FakeAddrInfoGetter . |
Method | add |
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. |
Method | getaddrinfo |
Mock for socket.getaddrinfo . |
Instance Variable | calls |
Undocumented |
Instance Variable | results |
Undocumented |
def addResultForHost(self, host, sockaddr, family=AF_INET, socktype=SOCK_STREAM, proto=IPPROTO_TCP, canonname=b''):
(source)
¶
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.
Parameters | |
host | The hostname to give this result for. This will be the next result from FakeAddrInfoGetter.getaddrinfo when passed this host. |
sockaddr | The resulting socket address; should be a 2-tuple for IPv4 or a 4-tuple for IPv6. |
family | An AF_* constant that will be returned from getaddrinfo. |
socktype | A SOCK_* constant that will be returned from getaddrinfo. |
proto | An IPPROTO_* constant that will be returned from getaddrinfo. |
canonname:native str | A canonical name that will be returned from getaddrinfo. |
Mock for socket.getaddrinfo
.
Parameters | |
host | see socket.getaddrinfo |
port | see socket.getaddrinfo |
family | see socket.getaddrinfo |
socktype | see socket.getaddrinfo |
proto | see socket.getaddrinfo |
flags | see socket.getaddrinfo |
Returns | |
socket.getaddrinfo |