summaryrefslogtreecommitdiff
path: root/src/mailman/testing/documentation.py
diff options
context:
space:
mode:
authorBarry Warsaw2017-02-06 15:30:01 +0000
committerBarry Warsaw2017-02-06 15:30:01 +0000
commit03e04a93efa312bfec58dd267959d401e9bcf22b (patch)
treedb590d461c1e9c956c1f562f826d8ba0ddf405b3 /src/mailman/testing/documentation.py
parenta75a718fa9073a51df8ce4deafe8a4851818b0a7 (diff)
parent26e9f870a3d6aea1c7ff4d576d9b38e3b4d5bbbc (diff)
downloadmailman-03e04a93efa312bfec58dd267959d401e9bcf22b.tar.gz
mailman-03e04a93efa312bfec58dd267959d401e9bcf22b.tar.zst
mailman-03e04a93efa312bfec58dd267959d401e9bcf22b.zip
Diffstat (limited to 'src/mailman/testing/documentation.py')
-rw-r--r--src/mailman/testing/documentation.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mailman/testing/documentation.py b/src/mailman/testing/documentation.py
index 33678a7d0..fc75e7a93 100644
--- a/src/mailman/testing/documentation.py
+++ b/src/mailman/testing/documentation.py
@@ -92,8 +92,17 @@ def call_http(url, data=None, method=None, username=None, password=None):
"""
content, response = call_api(url, data, method, username, password)
if content is None:
- for header in sorted(response):
- print('{}: {}'.format(header, response[header]))
+ # We used to use httplib2 here, which included the status code in the
+ # response headers in the `status` key. requests doesn't do this, but
+ # the doctests expect it so for backward compatibility, include the
+ # status code in the printed response.
+ headers = dict(status=response.status_code)
+ headers.update({
+ field.lower(): response.headers[field]
+ for field in response.headers
+ })
+ for field in sorted(headers):
+ print('{}: {}'.format(field, headers[field]))
return None
return content