Author: barry.warsaw
Date: Mon Mar 21 11:16:04 2005
New Revision: 41
Added:
trunk/mailman/src/mailman/database/tests/test_mlist.py
Modified:
trunk/mailman/src/mailman/database/schema.py
Log:
Add a test for mailing list creation.
MessageCollection.message -> .messages
Removed the backlink from Roster to MailingList because rosters are associated
with multiple columns in the MailingList table.
Modified: trunk/mailman/src/mailman/database/schema.py
==============================================================================
--- trunk/mailman/src/mailman/database/schema.py (original)
+++ trunk/mailman/src/mailman/database/schema.py Mon Mar 21 11:16:04 2005
@@ -43,8 +43,8 @@
request_response = ForeignKey('Autoresponse', default=None)
archives = ForeignKey('MessageCollection')
owner_archives = ForeignKey('MessageCollection')
- list_style = ForeignKey('ListStyle')
- overrides = ForeignKey('AttributeGroup')
+ list_style = ForeignKey('ListStyle', default=None)
+ overrides = ForeignKey('AttributeGroup', default=None)
@@ -67,7 +67,6 @@
class Roster(SQLObject):
_cacheValue = False
# Attributes
- mailing_list = ForeignKey('MailingList', default=None)
entries = MultipleJoin('RosterEntry', joinColumn='member_of_id')
@@ -193,7 +192,7 @@
class MessageCollection(SQLObject):
_cacheValue = False
# Attributes
- message = RelatedJoin('Message')
+ messages = RelatedJoin('Message')
Added: trunk/mailman/src/mailman/database/tests/test_mlist.py
==============================================================================
--- (empty file)
+++ trunk/mailman/src/mailman/database/tests/test_mlist.py Mon Mar 21
11:16:04 2005
@@ -0,0 +1,61 @@
+# Copyright (C) 2005 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.
+
+import datetime
+import unittest
+
+from mailman.database import schema
+from mailman.database.tests.base import DatabaseTest
+
+
+
+class TestMailingList(DatabaseTest):
+ def test_create_list(self):
+ eq = self.assertEqual
+ owners = schema.Roster()
+ moderators = schema.Roster()
+ members = schema.Roster()
+ # Create a mailing list domain
+ domain_admins = schema.Roster()
+ domain = schema.Domain(mailhost='localhost', admins=domain_admins)
+ # Create the required message collection
+ archives = schema.MessageCollection()
+ owner_archives = schema.MessageCollection()
+ # Finally! Create the mailing list.
+ mlist = schema.MailingList(name='test',
+ owners=owners,
+ moderators=moderators,
+ members=members,
+ domain=domain,
+ archives=archives,
+ owner_archives=owner_archives,
+ )
+ eq(mlist.name, 'test')
+ self.failUnless(mlist.creation_date <= datetime.datetime.now())
+ eq(mlist.domain.mailhost, 'localhost')
+ eq(mlist.domain.webhost, None)
+ eq(mlist.overrides, None)
+ eq(mlist.post_response, None)
+ eq(list(mlist.members.entries), [])
+ eq(list(mlist.archives.messages), [])
+ self.assertNotEqual(mlist.owners, mlist.members)
+
+
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestMailingList))
+ return suite
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org