summaryrefslogtreecommitdiff
path: root/src/mailman/runners/tests
diff options
context:
space:
mode:
authorBarry Warsaw2012-03-04 02:53:44 -0500
committerBarry Warsaw2012-03-04 02:53:44 -0500
commit6c8cbfc327e05b11f22e675941f320731f3c79ce (patch)
treea594634a0f824b84e2e6645db913dcb0f6fee0ac /src/mailman/runners/tests
parentfe855654a1c67fad869c3035548b6f1b51350258 (diff)
downloadmailman-6c8cbfc327e05b11f22e675941f320731f3c79ce.tar.gz
mailman-6c8cbfc327e05b11f22e675941f320731f3c79ce.tar.zst
mailman-6c8cbfc327e05b11f22e675941f320731f3c79ce.zip
* A welcome message is sent when the user confirms their subscription via
email. Also: - The user's Full Name is included on the To line of a welcome message. - Clean up some tests. - The welcome_message_uri for lists using the default style is set to mailman:///welcome.txt so a welcome message is sent by default.
Diffstat (limited to 'src/mailman/runners/tests')
-rw-r--r--src/mailman/runners/tests/test_confirm.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/mailman/runners/tests/test_confirm.py b/src/mailman/runners/tests/test_confirm.py
index 21dc653d2..34a2af523 100644
--- a/src/mailman/runners/tests/test_confirm.py
+++ b/src/mailman/runners/tests/test_confirm.py
@@ -52,6 +52,7 @@ class TestConfirm(unittest.TestCase):
# Register a subscription requiring confirmation.
registrar = getUtility(IRegistrar)
self._mlist = create_list('test@example.com')
+ self._mlist.send_welcome_message = False
self._token = registrar.register(self._mlist, 'anne@example.org')
self._commandq = config.switchboards['command']
self._runner = make_testable_runner(CommandRunner, 'command')
@@ -231,3 +232,32 @@ From: Anne Person <anne@example.org>
in_results = True
self.assertEqual(len(confirmation_lines), 1)
self.assertFalse('did not match' in confirmation_lines[0])
+
+ def test_welcome_message_after_confirmation(self):
+ # Confirmations with a welcome message set.
+ self._mlist.send_welcome_message = True
+ self._mlist.welcome_message_uri = 'mailman:///welcome.txt'
+ # 'confirm' in the Subject and in the To header should not try to
+ # confirm the token twice.
+ #
+ # Clear out the virgin queue so that the test below only sees the
+ # reply to the confirmation message.
+ get_queue_messages('virgin')
+ subject = 'Re: confirm {0}'.format(self._token)
+ to = 'test-confirm+{0}@example.com'.format(self._token)
+ msg = mfs("""\
+From: Anne Person <anne@example.org>
+
+""")
+ msg['Subject'] = subject
+ msg['To'] = to
+ self._commandq.enqueue(msg, dict(listname='test@example.com',
+ subaddress='confirm'))
+ self._runner.run()
+ # Now there's a email command notification and a welcome message. All
+ # we care about for this test is the welcome message.
+ messages = get_queue_messages('virgin', sort_on='subject')
+ self.assertEqual(len(messages), 2)
+ message = messages[1].msg
+ self.assertEqual(str(message['subject']),
+ 'Welcome to the "Test" mailing list')