Update of /cvsroot/mailman/mailman3/src/mailman/handlers/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31133/src/mailman/handlers/tests

Added Files:
      Tag: 3.0
        __init__.py test_messageid.py 
Log Message:
Initial checkin of Mailman3 source

--- NEW FILE: __init__.py ---

--- NEW FILE: test_messageid.py ---
# Copyright (C) 2003 Barry A. Warsaw
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

"""Test the messageid.py handler."""

import unittest
from email.Message import Message

from mailman.handlers.messageid import process



class TestMessageID(unittest.TestCase):
    def setUp(self):
        # Create a fake MailList object
        class FakeMailList:
            def listId(self):
                return 'testlist.dom.ain'
        self._mlist = FakeMailList()

    def test_add_message_id(self):
        msg = Message()
        assert msg['message-id'] is None
        d = {}
        process(self._mlist, msg, d)
        self.assertEqual(msg['message-id'], d['message-id'])
        i = d['message-id'].find(self._mlist.listId())
        self.failUnless(i >= 0)

    def test_has_message_id(self):
        msg = Message()
        msg['message-id'] = id = '<some.existing.id>'
        d = {}
        process(self._mlist, msg, d)
        self.assertEqual(msg['message-id'], id)
        self.assertEqual(d['message-id'], id)



def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TestMessageID))
    return suite


_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
Unsubscribe: http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to