Commit 09ae2e94 authored by Alexandre's avatar Alexandre
Browse files

Extract truncated tests from default

parent e1d4ff7e
......@@ -197,12 +197,10 @@ def create_requests_list(dot=dot, **req_args):
if dot:
requests.append(('Test 1', create_request(dot=dot, **req_args)))
requests.append(('Test 2', create_request(dot=dot, **req_args)))
requests.append(('Test truncated data', create_request(dot=dot, trunc=True, **req_args)))
else:
requests.append(('Test GET', create_request(**req_args), DOH_GET))
requests.append(('Test POST', create_request(**req_args), DOH_POST))
requests.append(('Test HEAD', create_request(**req_args), DOH_HEAD))
requests.append(('Test truncated data', create_request(trunc=True, **req_args), DOH_POST))
return requests
......@@ -600,8 +598,31 @@ def run_check_mime(connection, accept="application/dns-message", content_type="a
connection.curl.setopt(pycurl.HTTPHEADER, default_header)
return ok
def run_check_trunc(connection):
ok = True
test_name = 'Test truncated data'
if verbose:
print(test_name)
req_args = { 'qname': name, 'qtype': rtype, 'use_edns': edns, 'want_dnssec': dnssec }
if dot:
request = create_request(dot=dot, trunc=True, **req_args)
else:
request = create_request(trunc=True, **req_args)
request.post = True
try:
connection.send_and_receive(request)
except CustomException as e:
ok = False
error(e)
request.check_response()
if not print_result(connection, request, prefix=test_name):
ok = False
return ok
def run_check_additionals(connection):
if not run_check_trunc(connection):
return False
if not run_check_mime(connection, accept="text/html"):
return False
if not run_check_mime(connection, content_type="text/html"):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment