From e5c04e2a93a58d799dd3940a7935853eb1f2e3e4 Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Sat, 2 Jun 2007 02:06:53 +0000 Subject: rename a few tests --- Mailman/docs/listmanager.txt | 124 ++++++++++++++++++++++++++++++++ Mailman/docs/use-listmanager.txt | 124 -------------------------------- Mailman/docs/use-usermanager.txt | 100 -------------------------- Mailman/docs/usermanager.txt | 100 ++++++++++++++++++++++++++ Mailman/testing/test_listmanager.py | 28 ++++++++ Mailman/testing/test_use_listmanager.py | 28 -------- Mailman/testing/test_use_usermanager.py | 28 -------- Mailman/testing/test_usermanager.py | 28 ++++++++ 8 files changed, 280 insertions(+), 280 deletions(-) create mode 100644 Mailman/docs/listmanager.txt delete mode 100644 Mailman/docs/use-listmanager.txt delete mode 100644 Mailman/docs/use-usermanager.txt create mode 100644 Mailman/docs/usermanager.txt create mode 100644 Mailman/testing/test_listmanager.py delete mode 100644 Mailman/testing/test_use_listmanager.py delete mode 100644 Mailman/testing/test_use_usermanager.py create mode 100644 Mailman/testing/test_usermanager.py diff --git a/Mailman/docs/listmanager.txt b/Mailman/docs/listmanager.txt new file mode 100644 index 000000000..9e237f02f --- /dev/null +++ b/Mailman/docs/listmanager.txt @@ -0,0 +1,124 @@ +Using the IListManager interface +================================ + +The IListManager is how you create, delete, and retrieve mailing list +objects. The Mailman system instantiates an IListManager for you based on the +configuration variable MANAGERS_INIT_FUNCTION. The instance is accessible +on the global config object. + + >>> from Mailman.database import flush + >>> from Mailman.configuration import config + >>> from Mailman.interfaces import IListManager + >>> IListManager.providedBy(config.list_manager) + True + >>> mgr = config.list_manager + + +Creating a mailing list +----------------------- + +Creating the list returns the newly created IMailList object. + + >>> from Mailman.interfaces import IMailingList + >>> mlist = mgr.create('_xtest@example.com') + >>> flush() + >>> IMailingList.providedBy(mlist) + True + +This object has an identity. + + >>> from Mailman.interfaces import IMailingListIdentity + >>> IMailingListIdentity.providedBy(mlist) + True + +All lists with identities have a short name, a host name, and a fully +qualified listname. This latter is what uniquely distinguishes the mailing +list to the system. + + >>> mlist.list_name + '_xtest' + >>> mlist.host_name + 'example.com' + >>> mlist.fqdn_listname + '_xtest@example.com' + +If you try to create a mailing list with the same name as an existing list, +you will get an exception. + + >>> mlist_dup = mgr.create('_xtest@example.com') + Traceback (most recent call last): + ... + MMListAlreadyExistsError: _xtest@example.com + + +Deleting a mailing list +----------------------- + +Deleting an existing mailing list also deletes its rosters and roster sets. + + >>> sorted(r.name for r in config.user_manager.rosters) + ['', '_xtest@example.com moderators', '_xtest@example.com owners'] + + >>> mgr.delete(mlist) + >>> flush() + >>> sorted(mgr.names) + [] + >>> sorted(r.name for r in config.user_manager.rosters) + [''] + +Attempting to access attributes of the deleted mailing list raises an +exception: + + >>> mlist.fqdn_listname + Traceback (most recent call last): + ... + AttributeError: fqdn_listname + +After deleting the list, you can create it again. + + >>> mlist = mgr.create('_xtest@example.com') + >>> flush() + >>> mlist.fqdn_listname + '_xtest@example.com' + + +Retrieving a mailing list +------------------------- + +When a mailing list exists, you can ask the list manager for it and you will +always get the same object back. + + >>> mlist_2 = mgr.get('_xtest@example.com') + >>> mlist_2 is mlist + True + +Don't try to get a list that doesn't exist yet though, or you will get an +exception. + + >>> mgr.get('_xtest_2@example.com') + Traceback (most recent call last): + ... + MMUnknownListError: _xtest_2@example.com + + +Iterating over all mailing lists +-------------------------------- + +Once you've created a bunch of mailing lists, you can use the list manager to +iterate over either the list objects, or the list names. + + >>> mlist_3 = mgr.create('_xtest_3@example.com') + >>> mlist_4 = mgr.create('_xtest_4@example.com') + >>> flush() + >>> sorted(mgr.names) + ['_xtest@example.com', '_xtest_3@example.com', '_xtest_4@example.com'] + >>> sorted(m.fqdn_listname for m in mgr.mailing_lists) + ['_xtest@example.com', '_xtest_3@example.com', '_xtest_4@example.com'] + + +Cleaning up +----------- + + >>> for mlist in mgr.mailing_lists: + ... mgr.delete(mlist) + >>> flush() diff --git a/Mailman/docs/use-listmanager.txt b/Mailman/docs/use-listmanager.txt deleted file mode 100644 index 9e237f02f..000000000 --- a/Mailman/docs/use-listmanager.txt +++ /dev/null @@ -1,124 +0,0 @@ -Using the IListManager interface -================================ - -The IListManager is how you create, delete, and retrieve mailing list -objects. The Mailman system instantiates an IListManager for you based on the -configuration variable MANAGERS_INIT_FUNCTION. The instance is accessible -on the global config object. - - >>> from Mailman.database import flush - >>> from Mailman.configuration import config - >>> from Mailman.interfaces import IListManager - >>> IListManager.providedBy(config.list_manager) - True - >>> mgr = config.list_manager - - -Creating a mailing list ------------------------ - -Creating the list returns the newly created IMailList object. - - >>> from Mailman.interfaces import IMailingList - >>> mlist = mgr.create('_xtest@example.com') - >>> flush() - >>> IMailingList.providedBy(mlist) - True - -This object has an identity. - - >>> from Mailman.interfaces import IMailingListIdentity - >>> IMailingListIdentity.providedBy(mlist) - True - -All lists with identities have a short name, a host name, and a fully -qualified listname. This latter is what uniquely distinguishes the mailing -list to the system. - - >>> mlist.list_name - '_xtest' - >>> mlist.host_name - 'example.com' - >>> mlist.fqdn_listname - '_xtest@example.com' - -If you try to create a mailing list with the same name as an existing list, -you will get an exception. - - >>> mlist_dup = mgr.create('_xtest@example.com') - Traceback (most recent call last): - ... - MMListAlreadyExistsError: _xtest@example.com - - -Deleting a mailing list ------------------------ - -Deleting an existing mailing list also deletes its rosters and roster sets. - - >>> sorted(r.name for r in config.user_manager.rosters) - ['', '_xtest@example.com moderators', '_xtest@example.com owners'] - - >>> mgr.delete(mlist) - >>> flush() - >>> sorted(mgr.names) - [] - >>> sorted(r.name for r in config.user_manager.rosters) - [''] - -Attempting to access attributes of the deleted mailing list raises an -exception: - - >>> mlist.fqdn_listname - Traceback (most recent call last): - ... - AttributeError: fqdn_listname - -After deleting the list, you can create it again. - - >>> mlist = mgr.create('_xtest@example.com') - >>> flush() - >>> mlist.fqdn_listname - '_xtest@example.com' - - -Retrieving a mailing list -------------------------- - -When a mailing list exists, you can ask the list manager for it and you will -always get the same object back. - - >>> mlist_2 = mgr.get('_xtest@example.com') - >>> mlist_2 is mlist - True - -Don't try to get a list that doesn't exist yet though, or you will get an -exception. - - >>> mgr.get('_xtest_2@example.com') - Traceback (most recent call last): - ... - MMUnknownListError: _xtest_2@example.com - - -Iterating over all mailing lists --------------------------------- - -Once you've created a bunch of mailing lists, you can use the list manager to -iterate over either the list objects, or the list names. - - >>> mlist_3 = mgr.create('_xtest_3@example.com') - >>> mlist_4 = mgr.create('_xtest_4@example.com') - >>> flush() - >>> sorted(mgr.names) - ['_xtest@example.com', '_xtest_3@example.com', '_xtest_4@example.com'] - >>> sorted(m.fqdn_listname for m in mgr.mailing_lists) - ['_xtest@example.com', '_xtest_3@example.com', '_xtest_4@example.com'] - - -Cleaning up ------------ - - >>> for mlist in mgr.mailing_lists: - ... mgr.delete(mlist) - >>> flush() diff --git a/Mailman/docs/use-usermanager.txt b/Mailman/docs/use-usermanager.txt deleted file mode 100644 index f79bff8c6..000000000 --- a/Mailman/docs/use-usermanager.txt +++ /dev/null @@ -1,100 +0,0 @@ -The user manager and rosters -============================ - -The IUserManager is how you create, delete, and roster objects. Rosters -manage collections of users. The Mailman system instantiates an IUserManager -for you based on the configuration variable MANAGERS_INIT_FUNCTION. The -instance is accessible on the global config object. - - >>> from Mailman.configuration import config - >>> from Mailman.interfaces import IUserManager - >>> mgr = config.user_manager - >>> IUserManager.providedBy(mgr) - True - - -The default roster ------------------- - -The user manager always contains at least one roster, the 'null' roster or -'all inclusive roster'. - - >>> sorted(roster.name for roster in mgr.rosters) - [''] - - -Adding rosters --------------- - -You create a roster to hold users. The only thing a roster needs is a name, -basically just an identifying string. - - >>> from Mailman.database import flush - >>> from Mailman.interfaces import IRoster - >>> roster = mgr.create_roster('roster-1') - >>> IRoster.providedBy(roster) - True - >>> roster.name - 'roster-1' - >>> flush() - -If you try to create a roster with the same name as an existing roster, you -will get an exception. - - >>> roster_dup = mgr.create_roster('roster-1') - Traceback (most recent call last): - ... - RosterExistsError: roster-1 - - -Deleting a roster ------------------ - -Delete the roster, and you can then create it again. - - >>> mgr.delete_roster(roster) - >>> flush() - >>> roster = mgr.create_roster('roster-1') - >>> flush() - >>> roster.name - 'roster-1' - - -Retrieving a roster -------------------- - -When a roster exists, you can ask the user manager for it and you will always -get the same object back. - - >>> roster_2 = mgr.get_roster('roster-1') - >>> roster_2.name - 'roster-1' - >>> roster is roster_2 - True - -Trying to get a roster that does not yet exist returns None. - - >>> print mgr.get_roster('no roster') - None - - -Iterating over all the rosters ------------------------------- - -Once you've created a bunch of rosters, you can use the user manager to -iterate over all the rosters. - - >>> roster_2 = mgr.create_roster('roster-2') - >>> roster_3 = mgr.create_roster('roster-3') - >>> roster_4 = mgr.create_roster('roster-4') - >>> flush() - >>> sorted(roster.name for roster in mgr.rosters) - ['', 'roster-1', 'roster-2', 'roster-3', 'roster-4'] - - -Cleaning up ------------ - - >>> for roster in mgr.rosters: - ... mgr.delete_roster(roster) - >>> flush() diff --git a/Mailman/docs/usermanager.txt b/Mailman/docs/usermanager.txt new file mode 100644 index 000000000..f79bff8c6 --- /dev/null +++ b/Mailman/docs/usermanager.txt @@ -0,0 +1,100 @@ +The user manager and rosters +============================ + +The IUserManager is how you create, delete, and roster objects. Rosters +manage collections of users. The Mailman system instantiates an IUserManager +for you based on the configuration variable MANAGERS_INIT_FUNCTION. The +instance is accessible on the global config object. + + >>> from Mailman.configuration import config + >>> from Mailman.interfaces import IUserManager + >>> mgr = config.user_manager + >>> IUserManager.providedBy(mgr) + True + + +The default roster +------------------ + +The user manager always contains at least one roster, the 'null' roster or +'all inclusive roster'. + + >>> sorted(roster.name for roster in mgr.rosters) + [''] + + +Adding rosters +-------------- + +You create a roster to hold users. The only thing a roster needs is a name, +basically just an identifying string. + + >>> from Mailman.database import flush + >>> from Mailman.interfaces import IRoster + >>> roster = mgr.create_roster('roster-1') + >>> IRoster.providedBy(roster) + True + >>> roster.name + 'roster-1' + >>> flush() + +If you try to create a roster with the same name as an existing roster, you +will get an exception. + + >>> roster_dup = mgr.create_roster('roster-1') + Traceback (most recent call last): + ... + RosterExistsError: roster-1 + + +Deleting a roster +----------------- + +Delete the roster, and you can then create it again. + + >>> mgr.delete_roster(roster) + >>> flush() + >>> roster = mgr.create_roster('roster-1') + >>> flush() + >>> roster.name + 'roster-1' + + +Retrieving a roster +------------------- + +When a roster exists, you can ask the user manager for it and you will always +get the same object back. + + >>> roster_2 = mgr.get_roster('roster-1') + >>> roster_2.name + 'roster-1' + >>> roster is roster_2 + True + +Trying to get a roster that does not yet exist returns None. + + >>> print mgr.get_roster('no roster') + None + + +Iterating over all the rosters +------------------------------ + +Once you've created a bunch of rosters, you can use the user manager to +iterate over all the rosters. + + >>> roster_2 = mgr.create_roster('roster-2') + >>> roster_3 = mgr.create_roster('roster-3') + >>> roster_4 = mgr.create_roster('roster-4') + >>> flush() + >>> sorted(roster.name for roster in mgr.rosters) + ['', 'roster-1', 'roster-2', 'roster-3', 'roster-4'] + + +Cleaning up +----------- + + >>> for roster in mgr.rosters: + ... mgr.delete_roster(roster) + >>> flush() diff --git a/Mailman/testing/test_listmanager.py b/Mailman/testing/test_listmanager.py new file mode 100644 index 000000000..165018fa6 --- /dev/null +++ b/Mailman/testing/test_listmanager.py @@ -0,0 +1,28 @@ +# 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 mailing list creation and deletion.""" + +import doctest +import unittest + + +def test_suite(): + suite = unittest.TestSuite() + suite.addTest(doctest.DocFileSuite('../docs/listmanager.txt', + optionflags=doctest.ELLIPSIS)) + return suite diff --git a/Mailman/testing/test_use_listmanager.py b/Mailman/testing/test_use_listmanager.py deleted file mode 100644 index f78b50a0f..000000000 --- a/Mailman/testing/test_use_listmanager.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 mailing list creation and deletion.""" - -import doctest -import unittest - - -def test_suite(): - suite = unittest.TestSuite() - suite.addTest(doctest.DocFileSuite('../docs/use-listmanager.txt', - optionflags=doctest.ELLIPSIS)) - return suite diff --git a/Mailman/testing/test_use_usermanager.py b/Mailman/testing/test_use_usermanager.py deleted file mode 100644 index 0484e3e10..000000000 --- a/Mailman/testing/test_use_usermanager.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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 mailing list creation and deletion.""" - -import doctest -import unittest - - -def test_suite(): - suite = unittest.TestSuite() - suite.addTest(doctest.DocFileSuite('../docs/use-usermanager.txt', - optionflags=doctest.ELLIPSIS)) - return suite diff --git a/Mailman/testing/test_usermanager.py b/Mailman/testing/test_usermanager.py new file mode 100644 index 000000000..fa115728e --- /dev/null +++ b/Mailman/testing/test_usermanager.py @@ -0,0 +1,28 @@ +# 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 mailing list creation and deletion.""" + +import doctest +import unittest + + +def test_suite(): + suite = unittest.TestSuite() + suite.addTest(doctest.DocFileSuite('../docs/usermanager.txt', + optionflags=doctest.ELLIPSIS)) + return suite -- cgit v1.3.1