class _HostnameEndpointMemoryReactorMixin(ClientEndpointTestCaseMixin): (source)
Known subclasses: twisted.internet.test.test_endpoints.HostnameEndpointMemoryIPv4ReactorTests
, twisted.internet.test.test_endpoints.HostnameEndpointMemoryIPv6ReactorTests
Common methods for testing HostnameEndpoint
against MemoryReactor
instances that do not provide IReactorPluggableNameResolver
.
Method | assert |
Compare host, port, timeout, and bindAddress in receivedArgs to expectedArgs. We ignore the factory because we don't only care what protocol comes out of the IStreamClientEndpoint.connect call. |
Method | connect |
No summary |
Method | expected |
Extract expected clients from the reactor. |
Method | synchronous |
A synchronous version of deferToThread . |
Method | test |
Instantiating HostnameEndpoint with a reactor that does not provide IReactorPluggableResolver emits a deprecation warning. |
Method | test_endpoint |
When HostnameEndpoint.connect cannot connect to its destination, the returned Deferred will fail with ConnectError. |
Method | test_errors |
Hostname resolution errors are logged. |
Inherited from ClientEndpointTestCaseMixin
:
Method | retrieve |
Retrieve a single factory that has connected using the given reactor. (This behavior is valid for TCP and SSL but needs to be overridden for UNIX.) |
Method | test_endpoint |
Calling Deferred.cancel on the Deferred returned from IStreamClientEndpoint.connect is errbacked with an expected ConnectingCancelledError exception. |
Method | test_endpoint |
The endpoint should pass it's connectArgs parameter to the reactor's listen methods. |
Method | test_endpoint |
A client endpoint can connect and returns a deferred who gets called back with a protocol instance. |
Method | test |
The endpoint provides interfaces.IStreamClientEndpoint |
Compare host, port, timeout, and bindAddress in receivedArgs to expectedArgs. We ignore the factory because we don't only care what protocol comes out of the IStreamClientEndpoint.connect call.
Parameters | |
received | tuple of (host, port, factory, timeout, bindAddress) that was passed to IReactorTCP.connectTCP . |
expected | tuple of (host, port, factory, timeout, bindAddress) that we expect to have been passed to IReactorTCP.connectTCP . |
Extract expected clients from the reactor.
Parameters | |
reactor | The MemoryReactor under test. |
Returns | |
List of calls to IReactorTCP.connectTCP |
A synchronous version of deferToThread
.
Parameters | |
f:callable | The callable to invoke. |
*args | Positional arguments to the callable. |
**kwargs | Keyword arguments to the callable. |
Returns | |
A Deferred that fires with the result of applying f to args and kwargs or the exception raised. |
Instantiating HostnameEndpoint
with a reactor that does not provide IReactorPluggableResolver
emits a deprecation warning.
twisted.internet.test.test_endpoints.ClientEndpointTestCaseMixin.test_endpointConnectFailure
When HostnameEndpoint.connect
cannot connect to its destination, the returned Deferred
will fail with ConnectError.