diff options
| author | Barry Warsaw | 2009-05-04 11:05:51 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2009-05-04 11:05:51 -0400 |
| commit | 70e6738197f225d486a555bfe7fca81073f38347 (patch) | |
| tree | 8e72b893df67d990ad888fc46964589321ab53a5 /src/mailman/tests/test_documentation.py | |
| parent | e920c98c72fc9674316ae32c26a81fe571964ea5 (diff) | |
| download | mailman-70e6738197f225d486a555bfe7fca81073f38347.tar.gz mailman-70e6738197f225d486a555bfe7fca81073f38347.tar.zst mailman-70e6738197f225d486a555bfe7fca81073f38347.zip | |
Diffstat (limited to 'src/mailman/tests/test_documentation.py')
| -rw-r--r-- | src/mailman/tests/test_documentation.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mailman/tests/test_documentation.py b/src/mailman/tests/test_documentation.py index e0ddf025c..d1ff75275 100644 --- a/src/mailman/tests/test_documentation.py +++ b/src/mailman/tests/test_documentation.py @@ -30,11 +30,13 @@ __all__ = [ import os +import json import random import doctest import unittest from email import message_from_string +from urllib2 import urlopen import mailman @@ -103,6 +105,22 @@ def dump_msgdata(msgdata, *additional_skips): print '{0:{2}}: {1}'.format(key, msgdata[key], longest) +def dump_json(url): + """Print the JSON dictionary read from a URL. + + :param url: The url to open, read, and print. + :type url: string + """ + fp = urlopen(url) + # fp does not support the context manager protocol. + try: + data = json.load(fp) + finally: + fp.close() + for key in sorted(data): + print '{0}: {1}'.format(key, data[key]) + + def setup(testobj): """Test setup.""" @@ -113,6 +131,7 @@ def setup(testobj): testobj.globs['commit'] = config.db.commit testobj.globs['config'] = config testobj.globs['create_list'] = create_list + testobj.globs['dump_json'] = dump_json testobj.globs['dump_msgdata'] = dump_msgdata testobj.globs['message_from_string'] = specialized_message_from_string testobj.globs['smtpd'] = SMTPLayer.smtpd |
