Changeset 0560bb9 in mod_gnutls


Ignore:
Timestamp:
Dec 6, 2019, 11:10:38 AM (3 years ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio, main, master, proxy-ticket
Children:
f6d2721
Parents:
f9e13a5
Message:

Add some documentation for the Python test modules

Location:
test/mgstest
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/__init__.py

    rf9e13a5 r0560bb9  
    1515# limitations under the License.
    1616
     17"""Python modules for the mod_gnutls test suite."""
     18
    1719class TestExpectationFailed(Exception):
    1820    """Raise if a test failed. The constructor should be called with a
  • test/mgstest/http.py

    rf9e13a5 r0560bb9  
    1515# limitations under the License.
    1616
     17"""HTTP handling components for mod_gnutls tests."""
     18
    1719import socket
    1820import subprocess
     
    2224
    2325class HTTPSubprocessConnection(HTTPConnection):
     26    """An HTTPConnection that transports data through a subprocess instead
     27    of a socket. The mod_gnutls test suite uses it to transport data
     28    through gnutls-cli instead of the ssl module.
     29
     30    """
    2431    def __init__(self, command, host, port=None,
    2532                 output_filter=None,
  • test/mgstest/tests.py

    rf9e13a5 r0560bb9  
    1515# limitations under the License.
    1616
     17"""Test objects and support functions for the mod_gnutls test
     18suite. The classes defined in this module represent structures in the
     19YAML test configuration files.
     20
     21"""
     22
    1723import re
    1824import subprocess
     
    2329
    2430class TestConnection(yaml.YAMLObject):
     31    """An HTTP connection in a test. It includes parameters for the
     32    transport (currently gnutls-cli only), and the actions
     33    (e.g. sending requests) to take using this connection.
     34
     35    Note that running one TestConnection object may result in multiple
     36    sequential network connections, if the transport gets closed in a
     37    non-failure way (e.g. following a "Connection: close" request) and
     38    there are more actions, or (rarely) if an action requires its own
     39    transport.
     40
     41    """
    2542    yaml_tag = '!connection'
    2643
     
    6683
    6784class TestRequest(yaml.YAMLObject):
     85    """Test action that sends an HTTP/1.1 request.
     86
     87    The path must be specified in the configuration file, all other
     88    parameters (method, headers, expected response) have
     89    defaults.
     90
     91    Options for checking the response currently are:
     92    * require a specific response status
     93    * require the body to exactly match a specific string
     94    * require the body to contain all of a list of strings
     95
     96    """
    6897    yaml_tag = '!request'
    6998    def __init__(self, path, method='GET', headers=dict(),
     
    161190
    162191class TestRaw10(TestRequest):
    163     """This is a minimal (and likely incomplete) HTTP/1.0 test client for
    164     the one test case that strictly requires HTTP/1.0. All request
    165     parameters (method, path, headers) MUST be specified in the config
    166     file.
     192    """Test action that sends a request using a minimal (and likely
     193    incomplete) HTTP/1.0 test client for the one test case that
     194    strictly requires HTTP/1.0.
     195
     196    All request parameters (method, path, headers) MUST be specified
     197    in the config file. Checks on status and body work the same as for
     198    TestRequest.
    167199
    168200    """
     
    228260
    229261def filter_cert_log(in_stream, out_stream):
     262    """Filter to stop an erroneous gnutls-cli log message.
     263
     264    This function filters out a log line about loading client
     265    certificates that is mistakenly sent to stdout from gnutls-cli. My
     266    fix (https://gitlab.com/gnutls/gnutls/merge_requests/1125) has
     267    been merged, but buggy binaries will probably be around for a
     268    while.
     269
     270    The filter is meant to run in a multiprocessing.Process or
     271    threading.Thread that receives the stdout of gnutls-cli as
     272    in_stream, and a connection for further processing as out_stream.
     273
     274    """
    230275    import fcntl
    231276    import os
    232277    import select
    233     # This filters out a log line about loading client
    234     # certificates that is mistakenly sent to stdout. My fix has
    235     # been merged, but buggy binaries will probably be around for
    236     # a while.
    237     # https://gitlab.com/gnutls/gnutls/merge_requests/1125
     278    # message to filter
    238279    cert_log = b'Processed 1 client X.509 certificates...\n'
    239280
Note: See TracChangeset for help on using the changeset viewer.