summaryrefslogtreecommitdiff
path: root/Mailman/pipeline
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/pipeline')
-rw-r--r--Mailman/pipeline/docs/digests.txt24
1 files changed, 9 insertions, 15 deletions
diff --git a/Mailman/pipeline/docs/digests.txt b/Mailman/pipeline/docs/digests.txt
index 5e33050da..20c9191ae 100644
--- a/Mailman/pipeline/docs/digests.txt
+++ b/Mailman/pipeline/docs/digests.txt
@@ -21,15 +21,7 @@ This is a helper function used to iterate through all the accumulated digest
messages, in the order in which they were posted. This makes it easier to
update the tests when we switch to a different mailbox format.
- >>> import os, mailbox
- >>> def digest_mbox():
- ... path = os.path.join(mlist.full_path, 'digest.mbox')
- ... return mailbox.mbox(path)
-
- >>> def clear_mbox():
- ... path = os.path.join(mlist.full_path, 'digest.mbox')
- ... os.remove(path)
-
+ >>> from Mailman.tests.helpers import digest_mbox
>>> from itertools import count
>>> from string import Template
>>> def makemsg():
@@ -57,7 +49,7 @@ not allow digests...
>>> mlist.digestable = False
>>> msg = makemsg().next()
>>> process(mlist, msg, {})
- >>> sum(1 for mboxmsg in digest_mbox())
+ >>> sum(1 for mboxmsg in digest_mbox(mlist))
0
>>> switchboard.files
[]
@@ -66,7 +58,7 @@ not allow digests...
>>> mlist.digestable = True
>>> process(mlist, msg, dict(isdigest=True))
- >>> sum(1 for mboxmsg in digest_mbox())
+ >>> sum(1 for mboxmsg in digest_mbox(mlist))
0
>>> switchboard.files
[]
@@ -84,9 +76,11 @@ the message will just sit in the mailbox for a while.
>>> process(mlist, msg, {})
>>> switchboard.files
[]
- >>> sum(1 for mboxmsg in digest_mbox())
+ >>> digest = digest_mbox(mlist)
+ >>> sum(1 for mboxmsg in digest)
1
- >>> clear_mbox()
+ >>> import os
+ >>> os.remove(digest._path)
When the size of the digest mbox reaches the maximum size threshold, a digest
is crafted and sent out. This puts two messages in the virgin queue, an HTML
@@ -101,7 +95,7 @@ digest and an RFC 1153 plain text digest. The size threshold is in KB.
... size += len(str(msg))
... if size > mlist.digest_size_threshold * 1024:
... break
- >>> sum(1 for mboxmsg in digest_mbox())
+ >>> sum(1 for mboxmsg in digest_mbox(mlist))
0
>>> len(switchboard.files)
2
@@ -434,7 +428,7 @@ Set the digest threshold to zero so that the digests will be sent immediately.
>>> mlist.digest_size_threshold = 0
>>> process(mlist, msg, {})
- >>> sum(1 for mboxmsg in digest_mbox())
+ >>> sum(1 for mboxmsg in digest_mbox(mlist))
0
>>> len(switchboard.files)
2