diff options
| author | Barry Warsaw | 2008-02-17 23:34:09 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2008-02-17 23:34:09 -0500 |
| commit | 7ce2361faa1033bde84579ae9205944e5554b57f (patch) | |
| tree | 2574ab932f57aed10cb33ef43d6f27717da07617 /Mailman/tests/helpers.py | |
| parent | 69d158b13ae9cfa37040c2e7a664ca266b42050b (diff) | |
| download | mailman-7ce2361faa1033bde84579ae9205944e5554b57f.tar.gz mailman-7ce2361faa1033bde84579ae9205944e5554b57f.tar.zst mailman-7ce2361faa1033bde84579ae9205944e5554b57f.zip | |
Added a test for the built-in pipeline. Fixed some broken handler names in
the built-in pipeline.
Fixed DEFAULT_SUBJECT_PREFIX to take $-names instead of %-names, although I'm
not entirely sure the %%d stuff still works (we need a test for this).
Added IMailingList.real_name attribute and added this to the default style. A
column for this was in the database but not in the storm object. Also
re-enabled the style's subject_prefix attribute.
Moved some of the digest test functions into Mailman.tests.helpers.
Diffstat (limited to 'Mailman/tests/helpers.py')
| -rw-r--r-- | Mailman/tests/helpers.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Mailman/tests/helpers.py b/Mailman/tests/helpers.py index 1b24f11e6..180ac8af8 100644 --- a/Mailman/tests/helpers.py +++ b/Mailman/tests/helpers.py @@ -19,11 +19,18 @@ __metaclass__ = type __all__ = [ + 'digest_mbox', 'get_queue_messages', 'make_testable_runner', ] +import os +import mailbox + +from Mailman.queue import Switchboard + + def make_testable_runner(runner_class): """Create a queue runner that runs until its queue is empty. @@ -52,13 +59,26 @@ class _Bag: def get_queue_messages(queue): """Return and clear all the messages in the given queue. - :param queue: An ISwitchboard + :param queue: An ISwitchboard or a string naming a queue. :return: A list of 2-tuples where each item contains the message and message metadata. """ + if isinstance(queue, basestring): + queue = Switchboard(queue) messages = [] for filebase in queue.files: msg, msgdata = queue.dequeue(filebase) messages.append(_Bag(msg=msg, msgdata=msgdata)) queue.finish(filebase) return messages + + + +def digest_mbox(mlist): + """The mailing list's pending digest as a mailbox. + + :param mlist: The mailing list. + :return: The mailing list's pending digest as a mailbox. + """ + path = os.path.join(mlist.full_path, 'digest.mbox') + return mailbox.mbox(path) |
