summaryrefslogtreecommitdiff
path: root/Mailman/testing
diff options
context:
space:
mode:
authorbwarsaw2006-07-16 22:03:56 +0000
committerbwarsaw2006-07-16 22:03:56 +0000
commit7958b4d57dd75cb25894da523440c4dde78a0fa1 (patch)
tree829382c297bf2e84bfe84ec4718bd7f49cd95c29 /Mailman/testing
parent2863de361a5a597006d7ce57dc58f9c538021855 (diff)
downloadmailman-7958b4d57dd75cb25894da523440c4dde78a0fa1.tar.gz
mailman-7958b4d57dd75cb25894da523440c4dde78a0fa1.tar.zst
mailman-7958b4d57dd75cb25894da523440c4dde78a0fa1.zip
Add a framework for easier use of alternative MemberAdaptor implementations.
Also add an experimental (and currently non-functioning) SQLAlchemy implementation. The MemberAdaptor.py interface has been updated in a couple of ways. First, a "transaction interface" has been added so that Mailman can properly sync with the member adaptor. Newly supported methods are load(), lock(), save(), and unlock() and these correspond to methods in the MailList object. Second, __init__() is officially documented to take a MailList instance and nothing else. Third, some of the existing docstrings were incorrect w.r.t. the OldStyleMemberships implementation (such as rasing BadPasswordError in some cases). Most of these should not be the responsibility of the MemberAdaptor, so the docstrings have been updated. Test cases have been added and a new Defaults.py.in variable called MEMBER_ADAPTOR_CLASS has been added which names the class to use. Of course OldStyleMemberships are named by default. There's also a SQLALCHEMY_ENGINE_URL variable for use with the experimental member adaptor. Fix a bug in Configuration where if the etc/mailman.cfg file wasn't found and the mm_cfg.py file was used as a fallback, it would blow away the original namespace copied from Defaults.py.in. This wasn't a problem until we started adding additional names to that namespace, such as 'add_domain'.
Diffstat (limited to 'Mailman/testing')
-rw-r--r--Mailman/testing/base.py9
-rw-r--r--Mailman/testing/emailbase.py1
2 files changed, 9 insertions, 1 deletions
diff --git a/Mailman/testing/base.py b/Mailman/testing/base.py
index 589ab0abb..a65c62bdd 100644
--- a/Mailman/testing/base.py
+++ b/Mailman/testing/base.py
@@ -37,6 +37,9 @@ PERMISSIONS = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
class TestBase(unittest.TestCase):
def _configure(self, fp):
+## print >> fp, \
+## "MEMBER_ADAPTOR_CLASS = 'Mailman.SAMemberships.SAMemberships'"
+## config.MEMBER_ADAPTOR_CLASS = 'Mailman.SAMemberships.SAMemberships'
print >> fp, 'add_domain("example.com", "www.example.com")'
# Only add this domain once to the current process
if 'example.com' not in config.domains:
@@ -66,6 +69,11 @@ class TestBase(unittest.TestCase):
mlist = MailList.MailList()
mlist.Create('_xtest@example.com', 'owner@example.com', 'xxxxx')
mlist.Save()
+ # We need to reload the mailing list to ensure that the member
+ # adaptors are all sync'd up. This isn't strictly necessary with the
+ # OldStyleMemberships adaptor, but it may be required for other
+ # adaptors
+ mlist.Load()
# This leaves the list in a locked state
self._mlist = mlist
@@ -83,3 +91,4 @@ class TestBase(unittest.TestCase):
os.unlink(dir)
elif os.path.isdir(dir):
shutil.rmtree(dir)
+ os.unlink(self._config)
diff --git a/Mailman/testing/emailbase.py b/Mailman/testing/emailbase.py
index 48cb163e2..53b915abb 100644
--- a/Mailman/testing/emailbase.py
+++ b/Mailman/testing/emailbase.py
@@ -86,7 +86,6 @@ class EmailBase(TestBase):
else:
raise
TestBase.tearDown(self)
- os.remove(self._config)
def _readmsg(self):
global MSGTEXT