|
| 1 | +From 95364551209815ca2c2380ce270474989b924dda Mon Sep 17 00:00:00 2001 |
| 2 | +From: Igor Pashev < [email protected]> |
| 3 | +Date: Sat, 26 Jan 2019 11:48:48 +0200 |
| 4 | +Subject: [PATCH] Add --unix-socket option |
| 5 | + |
| 6 | +--- |
| 7 | + pyresttest/resttest.py | 9 +++++++++ |
| 8 | + 1 file changed, 9 insertions(+) |
| 9 | + |
| 10 | +diff --git a/pyresttest/resttest.py b/pyresttest/resttest.py |
| 11 | +index 0344746..845c438 100644 |
| 12 | +--- a/pyresttest/resttest.py |
| 13 | ++++ b/pyresttest/resttest.py |
| 14 | +@@ -111,6 +111,7 @@ class TestConfig: |
| 15 | + verbose = False |
| 16 | + ssl_insecure = False |
| 17 | + skip_term_colors = False # Turn off output term colors |
| 18 | ++ unix_socket = None |
| 19 | + |
| 20 | + # Binding and creation of generators |
| 21 | + variable_binds = None |
| 22 | +@@ -331,6 +332,8 @@ def run_test(mytest, test_config=TestConfig(), context=None, curl_handle=None, * |
| 23 | + if test_config.ssl_insecure: |
| 24 | + curl.setopt(pycurl.SSL_VERIFYPEER, 0) |
| 25 | + curl.setopt(pycurl.SSL_VERIFYHOST, 0) |
| 26 | ++ if test_config.unix_socket != None: |
| 27 | ++ curl.setopt(pycurl.UNIX_SOCKET_PATH, test_config.unix_socket) |
| 28 | + |
| 29 | + result.passed = None |
| 30 | + |
| 31 | +@@ -798,6 +801,7 @@ def main(args): |
| 32 | + Keys allowed for args: |
| 33 | + url - REQUIRED - Base URL |
| 34 | + test - REQUIRED - Test file (yaml) |
| 35 | ++ unix_socket - OPTIONAL - connect to this UNIX socket |
| 36 | + print_bodies - OPTIONAL - print response body |
| 37 | + print_headers - OPTIONAL - print response headers |
| 38 | + log - OPTIONAL - set logging level {debug,info,warning,error,critical} (default=warning) |
| 39 | +@@ -854,6 +858,9 @@ def main(args): |
| 40 | + if 'ssl_insecure' in args and args['ssl_insecure'] is not None: |
| 41 | + t.config.ssl_insecure = safe_to_bool(args['ssl_insecure']) |
| 42 | + |
| 43 | ++ if 'unix_socket' in args and args['unix_socket'] is not None: |
| 44 | ++ t.config.unix_socket = args['unix_socket'] |
| 45 | ++ |
| 46 | + if 'skip_term_colors' in args and args['skip_term_colors'] is not None: |
| 47 | + t.config.skip_term_colors = safe_to_bool(args['skip_term_colors']) |
| 48 | + |
| 49 | +@@ -877,6 +884,8 @@ def parse_command_line_args(args_in): |
| 50 | + action="store", type="string") |
| 51 | + parser.add_option( |
| 52 | + u"--url", help="Base URL to run tests against", action="store", type="string") |
| 53 | ++ parser.add_option(u"--unix-socket", help="Connect to this UNIX socket", |
| 54 | ++ action="store", type="string", dest="unix_socket") |
| 55 | + parser.add_option(u"--test", help="Test file to use", |
| 56 | + action="store", type="string") |
| 57 | + parser.add_option(u'--import_extensions', |
0 commit comments