Changeset 0560bb9 in mod_gnutls
- Timestamp:
- Dec 6, 2019, 11:10:38 AM (3 years ago)
- Branches:
- asyncio, main, master, proxy-ticket
- Children:
- f6d2721
- Parents:
- f9e13a5
- Location:
- test/mgstest
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
test/mgstest/__init__.py
rf9e13a5 r0560bb9 15 15 # limitations under the License. 16 16 17 """Python modules for the mod_gnutls test suite.""" 18 17 19 class TestExpectationFailed(Exception): 18 20 """Raise if a test failed. The constructor should be called with a -
test/mgstest/http.py
rf9e13a5 r0560bb9 15 15 # limitations under the License. 16 16 17 """HTTP handling components for mod_gnutls tests.""" 18 17 19 import socket 18 20 import subprocess … … 22 24 23 25 class 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 """ 24 31 def __init__(self, command, host, port=None, 25 32 output_filter=None, -
test/mgstest/tests.py
rf9e13a5 r0560bb9 15 15 # limitations under the License. 16 16 17 """Test objects and support functions for the mod_gnutls test 18 suite. The classes defined in this module represent structures in the 19 YAML test configuration files. 20 21 """ 22 17 23 import re 18 24 import subprocess … … 23 29 24 30 class 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 """ 25 42 yaml_tag = '!connection' 26 43 … … 66 83 67 84 class 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 """ 68 97 yaml_tag = '!request' 69 98 def __init__(self, path, method='GET', headers=dict(), … … 161 190 162 191 class 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. 167 199 168 200 """ … … 228 260 229 261 def 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 """ 230 275 import fcntl 231 276 import os 232 277 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 238 279 cert_log = b'Processed 1 client X.509 certificates...\n' 239 280
Note: See TracChangeset
for help on using the changeset viewer.