diff options
| author | Barry Warsaw | 2007-06-18 10:50:23 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2007-06-18 10:50:23 -0400 |
| commit | 511a33778c4195c4abca7c58aa6917e6a77059b6 (patch) | |
| tree | 5bffc7a5793a8247310294ac86931741e73b1fc5 /Mailman/testing | |
| parent | f0e3b3934d5d458cadd814eeae07277b58650180 (diff) | |
| download | mailman-511a33778c4195c4abca7c58aa6917e6a77059b6.tar.gz mailman-511a33778c4195c4abca7c58aa6917e6a77059b6.tar.zst mailman-511a33778c4195c4abca7c58aa6917e6a77059b6.zip | |
Remove both the model and interface for RosterSets. These are no longer used
or necessary in the current data model.
Convert the test_handlers.py Python test to an acknowledge.txt doctest, and
make the Acknowledge.py handler work with the new data model. There are a few
XXX comments left in here due to the fact that the web stuff is a total hack
in the current branch currently.
Added IMailingListWeb methods and properties to the MailingList model class:
web_host and script_url().
Work out how IMembers will expose the lookup-order based preferences. By
getting the attribute IMember.preferences you can see exactly the preferences
overridden by this member. To use the lookup order, use
IMember.delivery_mode, IMember.acknowledge_posts, etc. IOW, the IMember
interface now provides the properties directly and access through this
mechanism supports lookup order with definitive preference values.
Also added IMember.unsubscribe() which does the obvious, and
IMember.options_url() which is a total hack for providing a url (but not the
ultimately right one) for the user's option page.
Refactor the model's roster classes. Also added IRoster.get_member() method
with efficient queries to return the right results. Make
AdministratorRoster.members more efficient due to a better query.
Update the membership.txt doctest to eliminate a chance ordering effect, and
also to test finding members with .get_member(). The clean up section uses
the new .unsubscribe() method.
Diffstat (limited to 'Mailman/testing')
| -rw-r--r-- | Mailman/testing/test_acknowledge.py | 32 | ||||
| -rw-r--r-- | Mailman/testing/test_handlers.py | 129 |
2 files changed, 32 insertions, 129 deletions
diff --git a/Mailman/testing/test_acknowledge.py b/Mailman/testing/test_acknowledge.py new file mode 100644 index 000000000..a40d0c9e4 --- /dev/null +++ b/Mailman/testing/test_acknowledge.py @@ -0,0 +1,32 @@ +# Copyright (C) 2007 by the Free Software Foundation, Inc. +# +# This program 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 2 +# of the License, or (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. + +"""Doctest harness for testing message acknowledgment.""" + +import doctest +import unittest + +options = (doctest.ELLIPSIS + | doctest.NORMALIZE_WHITESPACE + | doctest.REPORT_NDIFF) + + +def test_suite(): + suite = unittest.TestSuite() + suite.addTest(doctest.DocFileSuite('../docs/acknowledge.txt', + optionflags=options)) + return suite diff --git a/Mailman/testing/test_handlers.py b/Mailman/testing/test_handlers.py index f4ad2ba4f..a0a196dae 100644 --- a/Mailman/testing/test_handlers.py +++ b/Mailman/testing/test_handlers.py @@ -62,135 +62,6 @@ def password(cleartext): -class TestAcknowledge(TestBase): - def setUp(self): - TestBase.setUp(self) - # We're going to want to inspect this queue directory - self._sb = Switchboard(config.VIRGINQUEUE_DIR) - # Add a member - self._mlist.addNewMember('aperson@example.org') - self._mlist.personalize = False - - def tearDown(self): - for f in os.listdir(config.VIRGINQUEUE_DIR): - os.unlink(os.path.join(config.VIRGINQUEUE_DIR, f)) - TestBase.tearDown(self) - - def test_no_ack_msgdata(self): - eq = self.assertEqual - # Make sure there are no files in the virgin queue already - eq(len(self._sb.files()), 0) - msg = email.message_from_string("""\ -From: aperson@example.org - -""", Message.Message) - Acknowledge.process(self._mlist, msg, - {'original_sender': 'aperson@example.org'}) - eq(len(self._sb.files()), 0) - - def test_no_ack_not_a_member(self): - eq = self.assertEqual - # Make sure there are no files in the virgin queue already - eq(len(self._sb.files()), 0) - msg = email.message_from_string("""\ -From: bperson@example.com - -""", Message.Message) - Acknowledge.process(self._mlist, msg, - {'original_sender': 'bperson@example.com'}) - eq(len(self._sb.files()), 0) - - def test_no_ack_sender(self): - eq = self.assertEqual - eq(len(self._sb.files()), 0) - msg = email.message_from_string("""\ -From: aperson@example.org - -""", Message.Message) - Acknowledge.process(self._mlist, msg, {}) - eq(len(self._sb.files()), 0) - - def test_ack_no_subject(self): - eq = self.assertEqual - self._mlist.setMemberOption( - 'aperson@example.org', config.AcknowledgePosts, 1) - eq(len(self._sb.files()), 0) - msg = email.message_from_string("""\ -From: aperson@example.org - -""", Message.Message) - Acknowledge.process(self._mlist, msg, {}) - files = self._sb.files() - eq(len(files), 1) - qmsg, qdata = self._sb.dequeue(files[0]) - # Check the .db file - eq(qdata.get('listname'), '_xtest@example.com') - eq(qdata.get('recips'), ['aperson@example.org']) - eq(qdata.get('version'), 3) - # Check the .pck - eq(str(qmsg['subject']), '_xtest post acknowledgement') - eq(qmsg['to'], 'aperson@example.org') - eq(qmsg['from'], '_xtest-bounces@example.com') - eq(qmsg.get_content_type(), 'text/plain') - eq(qmsg.get_param('charset'), 'us-ascii') - msgid = qmsg['message-id'] - self.failUnless(msgid.startswith('<mailman.')) - self.failUnless(msgid.endswith('._xtest@example.com>')) - eq(qmsg.get_payload(), """\ -Your message entitled - - (no subject) - -was successfully received by the _xtest mailing list. - -List info page: http://www.example.com/mailman/listinfo/_xtest@example.com -Your preferences: http://www.example.com/mailman/options/_xtest@example.com/aperson%40example.org -""") - # Make sure we dequeued the only message - eq(len(self._sb.files()), 0) - - def test_ack_with_subject(self): - eq = self.assertEqual - self._mlist.setMemberOption( - 'aperson@example.org', config.AcknowledgePosts, 1) - eq(len(self._sb.files()), 0) - msg = email.message_from_string("""\ -From: aperson@example.org -Subject: Wish you were here - -""", Message.Message) - Acknowledge.process(self._mlist, msg, {}) - files = self._sb.files() - eq(len(files), 1) - qmsg, qdata = self._sb.dequeue(files[0]) - # Check the .db file - eq(qdata.get('listname'), '_xtest@example.com') - eq(qdata.get('recips'), ['aperson@example.org']) - eq(qdata.get('version'), 3) - # Check the .pck - eq(str(qmsg['subject']), '_xtest post acknowledgement') - eq(qmsg['to'], 'aperson@example.org') - eq(qmsg['from'], '_xtest-bounces@example.com') - eq(qmsg.get_content_type(), 'text/plain') - eq(qmsg.get_param('charset'), 'us-ascii') - msgid = qmsg['message-id'] - self.failUnless(msgid.startswith('<mailman.')) - self.failUnless(msgid.endswith('._xtest@example.com>')) - eq(qmsg.get_payload(), """\ -Your message entitled - - Wish you were here - -was successfully received by the _xtest mailing list. - -List info page: http://www.example.com/mailman/listinfo/_xtest@example.com -Your preferences: http://www.example.com/mailman/options/_xtest@example.com/aperson%40example.org -""") - # Make sure we dequeued the only message - eq(len(self._sb.files()), 0) - - - class TestAfterDelivery(TestBase): # Both msg and msgdata are ignored def test_process(self): |
