source: mod_gnutls/test/tests/28_HTTP2_support/hooks.py @ 0f65ea9

asyncioproxy-ticket
Last change on this file since 0f65ea9 was 0f65ea9, checked in by Fiona Klute <fiona.klute@…>, 18 months ago

Use post_check hook in 28_HTTP2_support

  • Property mode set to 100644
File size: 985 bytes
RevLine 
[0909c92]1import os
[0f65ea9]2import re
[0909c92]3import subprocess
[0f65ea9]4from mgstest import require_match
[0909c92]5
6def run_connection(testname, conn_log, response_log):
7    url = f'https://{os.environ["TEST_HOST"]}:{os.environ["TEST_PORT"]}' \
8        '/status?auto'
9    command = [os.environ['HTTP_CLI'], '--http2', '--location', '--verbose',
10               '--cacert', 'authority/x509.pem', url]
11
12    proc = subprocess.run(command,
13                          stdout=subprocess.PIPE, stderr=subprocess.PIPE,
14                          check=True, text=True)
15    print(proc.stderr)
16    print(proc.stderr, file=conn_log)
17    print(proc.stdout)
18    print(proc.stdout, file=response_log)
[0f65ea9]19
20def post_check(conn_log, response_log):
21    print('Checking for HTTP/2 in logged header:')
22    print(require_match(re.compile(r'\bHTTP/2 200\b'), conn_log).group(0))
23    print('Checking for TLS session status:')
24    print(require_match(re.compile(r'^Current TLS session:\s\(TLS.*$'),
25                        response_log)
26          .group(0))
Note: See TracBrowser for help on using the repository browser.