~barry/mailman/lp1423756

« back to all changes in this revision

Viewing changes to src/mailman/runners/tests/test_join.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 mailing list joins."""
19
19
 
20
 
from __future__ import absolute_import, print_function, unicode_literals
21
 
 
22
 
__metaclass__ = type
23
20
__all__ = [
24
21
    'TestJoin',
25
22
    'TestJoinWithDigests',
29
26
import unittest
30
27
 
31
28
from email.iterators import body_line_iterator
32
 
from zope.component import getUtility
33
 
 
34
29
from mailman.app.lifecycle import create_list
35
30
from mailman.config import config
36
31
from mailman.interfaces.member import DeliveryMode
42
37
    get_queue_messages, make_testable_runner, reset_the_world,
43
38
    specialized_message_from_string as mfs)
44
39
from mailman.testing.layers import ConfigLayer
 
40
from zope.component import getUtility
45
41
 
46
42
 
47
43
 
72
68
        # Adding the subaddress to the metadata dictionary mimics what happens
73
69
        # when the above email message is first processed by the lmtp runner.
74
70
        # For convenience, we skip that step in this test.
75
 
        self._commandq.enqueue(msg, dict(listname='test@example.com',
 
71
        self._commandq.enqueue(msg, dict(listid='test.example.com',
76
72
                                         subaddress='join'))
77
73
        self._runner.run()
78
74
        # There will be two messages in the queue.  The first one is a reply
87
83
        # one 'Confirmation email' line.
88
84
        confirmation_lines = []
89
85
        in_results = False
90
 
        for line in body_line_iterator(messages[0].msg, decode=True):
 
86
        for line in body_line_iterator(messages[0].msg):
91
87
            line = line.strip()
92
88
            if in_results:
93
89
                if line.startswith('- Done'):
112
108
Subject: join
113
109
 
114
110
""")
115
 
        self._commandq.enqueue(msg, dict(listname='test@example.com'))
 
111
        self._commandq.enqueue(msg, dict(listid='test.example.com'))
116
112
        self._runner.run()
117
113
        # There will be one message in the queue - a reply to Anne notifying
118
114
        # her of the status of her command email.  Because Anne is already
125
121
        # one 'Confirmation email' line.
126
122
        confirmation_lines = []
127
123
        in_results = False
128
 
        for line in body_line_iterator(messages[0].msg, decode=True):
 
124
        for line in body_line_iterator(messages[0].msg):
129
125
            line = line.strip()
130
126
            if in_results:
131
127
                if line.startswith('- Done'):
181
177
 
182
178
join
183
179
""")
184
 
        self._commandq.enqueue(msg, dict(listname='test@example.com'))
 
180
        self._commandq.enqueue(msg, dict(listid='test.example.com'))
185
181
        self._runner.run()
186
182
        anne = self._confirm()
187
183
        self.assertEqual(anne.address.email, 'anne@example.org')
195
191
 
196
192
join digest=no
197
193
""")
198
 
        self._commandq.enqueue(msg, dict(listname='test@example.com'))
 
194
        self._commandq.enqueue(msg, dict(listid='test.example.com'))
199
195
        self._runner.run()
200
196
        anne = self._confirm()
201
197
        self.assertEqual(anne.address.email, 'anne@example.org')
209
205
 
210
206
join digest=mime
211
207
""")
212
 
        self._commandq.enqueue(msg, dict(listname='test@example.com'))
 
208
        self._commandq.enqueue(msg, dict(listid='test.example.com'))
213
209
        self._runner.run()
214
210
        anne = self._confirm()
215
211
        self.assertEqual(anne.address.email, 'anne@example.org')
223
219
 
224
220
join digest=plain
225
221
""")
226
 
        self._commandq.enqueue(msg, dict(listname='test@example.com'))
 
222
        self._commandq.enqueue(msg, dict(listid='test.example.com'))
227
223
        self._runner.run()
228
224
        anne = self._confirm()
229
225
        self.assertEqual(anne.address.email, 'anne@example.org')