~barry/mailman/lp1423756

« back to all changes in this revision

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

  • Committer: Barry Warsaw
  • Date: 2015-01-05 01:20:33 UTC
  • mfrom: (7264.4.66 py3)
  • Revision ID: barry@list.org-20150105012033-zdrw9c2odhpf22fz
Merge the Python 3 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Test the archive runner."""
19
19
 
20
 
from __future__ import absolute_import, print_function, unicode_literals
21
 
 
22
 
__metaclass__ = type
23
20
__all__ = [
24
21
    'TestArchiveRunner',
25
22
    ]
29
26
import unittest
30
27
 
31
28
from email import message_from_file
32
 
from zope.interface import implementer
33
 
 
34
29
from mailman.app.lifecycle import create_list
35
30
from mailman.config import config
36
31
from mailman.interfaces.archiver import IArchiver
37
32
from mailman.interfaces.mailinglist import IListArchiverSet
38
33
from mailman.runners.archive import ArchiveRunner
39
34
from mailman.testing.helpers import (
40
 
    configuration,
41
 
    make_testable_runner,
 
35
    configuration, make_testable_runner,
42
36
    specialized_message_from_string as mfs)
43
37
from mailman.testing.layers import ConfigLayer
44
38
from mailman.utilities.datetime import RFC822_DATE_FMT, factory, now
 
39
from zope.interface import implementer
45
40
 
46
41
 
47
42
 
110
105
        # Ensure that the archive runner ends up archiving the message.
111
106
        self._archiveq.enqueue(
112
107
            self._msg, {},
113
 
            listname=self._mlist.fqdn_listname,
 
108
            listid=self._mlist.list_id,
114
109
            received_time=now())
115
110
        self._runner.run()
116
111
        # There should now be a copy of the message in the file system.
126
121
        self._msg['Date'] = now(strip_tzinfo=False).strftime(RFC822_DATE_FMT)
127
122
        self._archiveq.enqueue(
128
123
            self._msg, {},
129
 
            listname=self._mlist.fqdn_listname,
 
124
            listid=self._mlist.list_id,
130
125
            received_time=now())
131
126
        self._runner.run()
132
127
        # There should now be a copy of the message in the file system.
144
139
        self._msg['Date'] = now(strip_tzinfo=False).strftime(RFC822_DATE_FMT)
145
140
        self._archiveq.enqueue(
146
141
            self._msg, {},
147
 
            listname=self._mlist.fqdn_listname,
 
142
            listid=self._mlist.list_id,
148
143
            received_time=now())
149
144
        self._runner.run()
150
145
        # There should now be a copy of the message in the file system.
163
158
        # again), fast forward a few days.
164
159
        self._archiveq.enqueue(
165
160
            self._msg, {},
166
 
            listname=self._mlist.fqdn_listname,
 
161
            listid=self._mlist.list_id,
167
162
            received_time=now(strip_tzinfo=False))
168
163
        self._runner.run()
169
164
        # There should now be a copy of the message in the file system.
182
177
        # again as will happen in the runner), fast forward a few days.
183
178
        self._archiveq.enqueue(
184
179
            self._msg, {},
185
 
            listname=self._mlist.fqdn_listname)
 
180
            listid=self._mlist.list_id)
186
181
        factory.fast_forward(days=4)
187
182
        self._runner.run()
188
183
        # There should now be a copy of the message in the file system.
205
200
        # again as will happen in the runner), fast forward a few days.
206
201
        self._archiveq.enqueue(
207
202
            self._msg, {},
208
 
            listname=self._mlist.fqdn_listname)
 
203
            listid=self._mlist.list_id)
209
204
        factory.fast_forward(days=4)
210
205
        self._runner.run()
211
206
        # There should now be a copy of the message in the file system.
228
223
        # again as will happen in the runner), fast forward a few days.
229
224
        self._archiveq.enqueue(
230
225
            self._msg, {},
231
 
            listname=self._mlist.fqdn_listname)
 
226
            listid=self._mlist.list_id)
232
227
        factory.fast_forward(days=4)
233
228
        self._runner.run()
234
229
        # There should now be a copy of the message in the file system.
249
244
        config.db.store.commit()
250
245
        self._archiveq.enqueue(
251
246
            self._msg, {},
252
 
            listname=self._mlist.fqdn_listname)
 
247
            listid=self._mlist.list_id)
253
248
        self._runner.run()
254
249
        self.assertEqual(os.listdir(config.MESSAGES_DIR), [])