~sambuddhabasu1/mailman/fix_mailman_run_error

« back to all changes in this revision

Viewing changes to src/mailman/runners/tests/test_lmtp.py

  • Committer: Barry Warsaw
  • Date: 2012-03-26 12:04:00 UTC
  • Revision ID: barry@list.org-20120326120400-jfezy6cg60ygod7k
Architecture
------------
 * Internally, all datetimes are kept in the UTC timezone, however because of
   LP: #280708, they are stored in the database in naive format.
 * `received_time` is now added to the message metadata by the LMTP runner
   instead of by `Switchboard.enqueue()`.  This latter no longer depends on
   `received_time` in the metadata.
 * The `ArchiveRunner` no longer acquires a lock before it calls the
   individual archiver implementations, since not all of them need a lock.  If
   they do, the implementations must acquire said lock themselves.

Configuration
-------------
 * New configuration variables `clobber_date` and `clobber_skew` supported in
   every `[archiver.<name>]` section.  These are used to determine under what
   circumstances a message destined for a specific archiver should have its
   `Date:` header clobbered.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import smtplib
29
29
import unittest
30
30
 
 
31
from datetime import datetime
 
32
 
31
33
from mailman.app.lifecycle import create_list
32
34
from mailman.config import config
33
35
from mailman.testing.helpers import get_lmtp_client, get_queue_messages
96
98
        self.assertEqual(len(all_headers), 1)
97
99
        self.assertEqual(messages[0].msg['x-message-id-hash'],
98
100
                         'MS6QLWERIJLGCRF44J7USBFDELMNT2BW')
 
101
 
 
102
    def test_received_time(self):
 
103
        # The LMTP runner adds a `received_time` key to the metadata.
 
104
        self._lmtp.sendmail('anne@example.com', ['test@example.com'], """\
 
105
From: anne@example.com
 
106
To: test@example.com
 
107
Subject: This has no Message-ID header
 
108
Message-ID: <ant>
 
109
 
 
110
""")
 
111
        messages = get_queue_messages('in')
 
112
        self.assertEqual(len(messages), 1)
 
113
        self.assertEqual(messages[0].msgdata['received_time'],
 
114
                         datetime(2005, 8, 1, 7, 49, 23))