module documentation

A local ``httpbin`` server to run integration tests against. This ensures tests do not depend on `httpbin <https://httpbin.org/>`_.

Function _certificates_for_authority_and_server Create a self-signed CA certificate and server certificate signed by the CA.
Function _forever_httpbin Run ``httpbin`` forever.
Function _make_httpbin_site Return a :py:class:`Site` that hosts an ``httpbin`` WSGI application.
Function _output_process_description Write a process description to standard out.
Function _serve_tcp Serve a site over plain TCP.
Function _serve_tls Serve a site over TLS.
def _certificates_for_authority_and_server(service_identity, key_size=2048): (source)

Create a self-signed CA certificate and server certificate signed by the CA. :param service_identity: The identity (hostname) of the server. :type service_identity: :py:class:`unicode` :param key_size: (optional) The size of CA's and server's private RSA keys. Defaults to 2048 bits, which is the minimum allowed by OpenSSL Contexts at the default security level. :type key_size: :py:class:`int` :return: a 3-tuple of ``(certificate_authority_certificate, server_private_key, server_certificate)``. :rtype: :py:class:`tuple` of (:py:class:`sslverify.Certificate`, :py:class:`OpenSSL.crypto.PKey`, :py:class:`OpenSSL.crypto.X509`)

def _forever_httpbin(reactor, argv, _make_httpbin_site=_make_httpbin_site, _serve_tcp=_serve_tcp, _serve_tls=_serve_tls, _output_process_description=_output_process_description): (source)

Run ``httpbin`` forever. :param reactor: The Twisted reactor. :param argv: The arguments with which the script was ran. :type argv: :py:class:`list` of :py:class:`str` :return: a :py:class:`Deferred` that never fires.

def _make_httpbin_site(reactor, threadpool_factory=ThreadPool): (source)

Return a :py:class:`Site` that hosts an ``httpbin`` WSGI application. :param reactor: The reactor. :param threadpool_factory: (optional) A callable that creates a :py:class:`ThreadPool`. :return: A :py:class:`Site` that hosts ``httpbin``

def _output_process_description(description, stdout=sys.stdout): (source)

Write a process description to standard out. :param description: The process description. :type description: :py:class:`_HTTPBinDescription` :param stdout: (optional) Standard out.

@inlineCallbacks
def _serve_tcp(reactor, host, port, site): (source)

Serve a site over plain TCP. :param reactor: The reactor. :param host: The host on which to listen. :type host: :py:class:`str` :param port: The host on which to listen. :type port: :py:class:`int` :return: A :py:class:`Deferred` that fires with a :py:class:`_HTTPBinDescription`

@inlineCallbacks
def _serve_tls(reactor, host, port, site): (source)

Serve a site over TLS. :param reactor: The reactor. :param host: The host on which to listen. :type host: :py:class:`str` :param port: The host on which to listen. :type port: :py:class:`int` :type site: The :py:class:`Site` to serve. :return: A :py:class:`Deferred` that fires with a :py:class:`_HTTPBinDescription`