diff options
| author | Barry Warsaw | 2011-05-27 18:09:01 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-05-27 18:09:01 -0400 |
| commit | 7b7b63c34324efe4055c285106b3d7bf92dd322b (patch) | |
| tree | 0ff2a790b7cf6dc263f03b0a3923b01dca1e7aaf /src/mailman/queue/tests | |
| parent | 0795e34d56a8f627348730843210cdba4071b26b (diff) | |
| download | mailman-7b7b63c34324efe4055c285106b3d7bf92dd322b.tar.gz mailman-7b7b63c34324efe4055c285106b3d7bf92dd322b.tar.zst mailman-7b7b63c34324efe4055c285106b3d7bf92dd322b.zip | |
* bounce_processing -> process_bounces
* Finally get rid of BounceMixin
* Test the simple case where the mailing list does no bounce processing.
Diffstat (limited to 'src/mailman/queue/tests')
| -rw-r--r-- | src/mailman/queue/tests/test_bounce.py | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/mailman/queue/tests/test_bounce.py b/src/mailman/queue/tests/test_bounce.py new file mode 100644 index 000000000..ba2476e79 --- /dev/null +++ b/src/mailman/queue/tests/test_bounce.py @@ -0,0 +1,78 @@ +# Copyright (C) 2011 by the Free Software Foundation, Inc. +# +# This file is part of GNU Mailman. +# +# GNU Mailman is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# GNU Mailman. If not, see <http://www.gnu.org/licenses/>. + +"""Test the bounce queue runner.""" + +from __future__ import absolute_import, unicode_literals + +__metaclass__ = type +__all__ = [ + 'test_suite', + ] + + +import unittest + +from zope.component import getUtility + +from mailman.app.lifecycle import create_list +from mailman.config import config +from mailman.interfaces.member import MemberRole +from mailman.interfaces.usermanager import IUserManager +from mailman.queue.bounce import BounceRunner +from mailman.testing.helpers import ( + get_queue_messages, + make_testable_runner, + specialized_message_from_string as message_from_string) +from mailman.testing.layers import ConfigLayer + + + +class TestBounceQueue(unittest.TestCase): + """Test the bounce queue runner.""" + + layer = ConfigLayer + + def setUp(self): + self._mlist = create_list('test@example.com') + self._bounceq = config.switchboards['bounces'] + self._runner = make_testable_runner(BounceRunner, 'bounces') + self._anne = getUtility(IUserManager).create_address( + 'anne@example.com') + self._member = self._mlist.subscribe(self._anne, MemberRole.member) + self._msg = message_from_string("""\ +From: mail-daemon@example.com +To: test-bounce+anne=example.com@example.com +Message-Id: <first> + +""") + self._msgdata = dict(listname='test@example.com') + + def test_does_no_processing(self): + # If the mailing list does no bounce processing, the messages are + # simply discarded. + self._mlist.bounce_processing = False + self._bounceq.enqueue(self._msg, self._msgdata) + self._runner.run() + self.assertEqual(len(get_queue_messages('bounces')), 0) + + + +def test_suite(): + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(TestBounceQueue)) + return suite |
