Beispiel #1
0
def get_multitest(name):
    """
    Creates and returns a new MultiTest instance to be added to the plan.
    The environment is a server and a client connecting using the context
    functionality that retrieves host/port of the server after is started.
    """
    # The HTTPServer can be passed handler_attributes in a dictionary. These
    # will be accessible in the custom HTTP request handler
    # (see custom_http_request_handler.py).
    attributes = {"text_file": "test.txt"}
    test = MultiTest(
        name=name,
        suites=[HTTPTestsuite()],
        environment=[
            HTTPServer(
                name="http_server",
                request_handler=CustomHTTPRequestHandler,
                handler_attributes=attributes,
            ),
            HTTPClient(
                name="http_client",
                host=context("http_server", "{{host}}"),
                port=context("http_server", "{{port}}"),
            ),
        ],
    )
    return test
Beispiel #2
0
def create_client(name, host, port, timeout):
    client = HTTPClient(name=name,
                        host=host,
                        port=port,
                        timeout=timeout)
    client.start()
    client._wait_started()
    return client
Beispiel #3
0
def get_multitest(name):
    """
    Creates and returns a new MultiTest instance to be added to the plan.
    The environment is a server and a client connecting using the context
    functionality that retrieves host/port of the server after is started.
    """
    test = MultiTest(name=name,
                     suites=[HTTPTestsuite()],
                     environment=[
                         HTTPServer(name='http_server'),
                         HTTPClient(name='http_client',
                                    host=context('http_server', '{{host}}'),
                                    port=context('http_server', '{{port}}'))
                     ])
    return test