~sambuddhabasu1/mailman/fix_mailman_run_error

« back to all changes in this revision

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

  • Committer: Barry Warsaw
  • Date: 2012-03-24 01:45:12 UTC
  • Revision ID: barry@list.org-20120324014512-qa086tsn10ttgcei
Last minute emergency bandaid for bug LP: #963612

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
        [archiver.mail_archive]
86
86
        enable: no
87
87
        """)
 
88
        self._archiveq = config.switchboards['archive']
88
89
        self._msg = mfs("""\
89
90
From: aperson@example.com
90
91
To: test@example.com
101
102
 
102
103
    def test_archive_runner(self):
103
104
        # Ensure that the archive runner ends up archiving the message.
104
 
        config.switchboards['archive'].enqueue(
 
105
        self._archiveq.enqueue(
 
106
            self._msg, {}, listname=self._mlist.fqdn_listname)
 
107
        self._runner.run()
 
108
        # There should now be a copy of the message in the file system.
 
109
        filename = os.path.join(
 
110
            config.MESSAGES_DIR, '4CMWUN6BHVCMHMDAOSJZ2Q72G5M32MWB')
 
111
        with open(filename) as fp:
 
112
            archived = message_from_file(fp)
 
113
        self.assertEqual(archived['message-id'], '<first>')
 
114
 
 
115
    def test_archive_runner_with_dated_message(self):
 
116
        # LP: #963612 FIXME
 
117
        self._msg['Date'] = 'Sat, 11 Mar 2011 03:19:38 -0500'
 
118
        self._archiveq.enqueue(
105
119
            self._msg, {}, listname=self._mlist.fqdn_listname)
106
120
        self._runner.run()
107
121
        # There should now be a copy of the message in the file system.