summaryrefslogtreecommitdiff
path: root/Mailman/testing/test_security_mgr.py
diff options
context:
space:
mode:
authorbwarsaw2006-07-30 19:21:02 +0000
committerbwarsaw2006-07-30 19:21:02 +0000
commit347bd559f5559775ac489e89c47c1206eae0711c (patch)
tree18cf9cf1ca5ca1feb786d3a6b0bd35b3078b5812 /Mailman/testing/test_security_mgr.py
parent13185804a6a138449be016fe187833c6630af991 (diff)
downloadmailman-347bd559f5559775ac489e89c47c1206eae0711c.tar.gz
mailman-347bd559f5559775ac489e89c47c1206eae0711c.tar.zst
mailman-347bd559f5559775ac489e89c47c1206eae0711c.zip
Upgrade to email package version 4.0.1. Because email 4.0.1 is only
compatible back to Python 2.3, this change should not get back ported to Mailman 2.1. Port to Python 2.5. The non-test suite changes should get back ported to Mailman 2.1 (which I will do next), but don't worry about the test suite ones because MM2.1's test suite is hopeless. Specifically: - In SecurityManager.py, fix the parsecookie() code to work with Python 2.5 generated cookie text. The latter was changed to be more RFC compliant so it does not output training semicolons for each line of cookie text. This broke the splitting rules, so now first split on newlines, then on ';\s*'. This should work across all Python versions. - In Python 2.5, exceptions are new-style, and thus are no longer of ClassType. The instantiation type test in hold_for_approval() was too naive. - Raising strings generates deprecation warnings in Python 2.5. Switch the one weird use of this in Utils.py to use a class exception. Don't call it "quick exit" though because it's probably not. - In the tests, use True/False instead of 1/0 - Use failUnless/failIf instead of assertEqual against True/False. - In the tests, use Message.get_content_type() instead of Message.get_type() since the latter is gone in email 4.0.1. Same with get_content_maintype() and get_main_type().
Diffstat (limited to 'Mailman/testing/test_security_mgr.py')
-rw-r--r--Mailman/testing/test_security_mgr.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/Mailman/testing/test_security_mgr.py b/Mailman/testing/test_security_mgr.py
index ea7db5d9f..4b2515140 100644
--- a/Mailman/testing/test_security_mgr.py
+++ b/Mailman/testing/test_security_mgr.py
@@ -90,8 +90,8 @@ class TestSecurityManager(TestBase):
class TestAuthenticate(TestBase):
def setUp(self):
TestBase.setUp(self)
- Utils.set_global_password('bbBBbb', siteadmin=1)
- Utils.set_global_password('ccCCcc', siteadmin=0)
+ Utils.set_global_password('bbBBbb', siteadmin=True)
+ Utils.set_global_password('ccCCcc', siteadmin=False)
def tearDown(self):
try:
@@ -206,8 +206,8 @@ class StripperIO(StringIO):
class TestWebAuthenticate(TestBase):
def setUp(self):
TestBase.setUp(self)
- Utils.set_global_password('bbBBbb', siteadmin=1)
- Utils.set_global_password('ccCCcc', siteadmin=0)
+ Utils.set_global_password('bbBBbb', siteadmin=True)
+ Utils.set_global_password('ccCCcc', siteadmin=False)
mlist = self._mlist
mlist.mod_password = password('abcdefg')
mlist.addNewMember('aperson@dom.ain', password='qqQQqq')
@@ -235,25 +235,25 @@ class TestWebAuthenticate(TestBase):
TestBase.tearDown(self)
def test_auth_site_admin(self):
- self.assertEqual(self._mlist.WebAuthenticate(
- [config.AuthSiteAdmin], 'xxxxxx'), 1)
+ self.failUnless(self._mlist.WebAuthenticate(
+ [config.AuthSiteAdmin], 'does not matter'))
def test_list_admin(self):
- self.assertEqual(self._mlist.WebAuthenticate(
- [config.AuthListAdmin], 'xxxxxx'), 1)
+ self.failUnless(self._mlist.WebAuthenticate(
+ [config.AuthListAdmin], 'does not matter'))
def test_list_moderator(self):
- self.assertEqual(self._mlist.WebAuthenticate(
- [config.AuthListModerator], 'xxxxxx'), 1)
+ self.failUnless(self._mlist.WebAuthenticate(
+ [config.AuthListModerator], 'does not matter'))
def test_user(self):
- self.assertEqual(self._mlist.WebAuthenticate(
- [config.AuthUser], 'xxxxxx'), 1)
+ self.failUnless(self._mlist.WebAuthenticate(
+ [config.AuthUser], 'does not matter'))
def test_not_a_user(self):
self._mlist.removeMember('aperson@dom.ain')
- self.assertEqual(self._mlist.WebAuthenticate(
- [config.AuthUser], 'xxxxxx', 'aperson@dom.ain'), 0)
+ self.failIf(self._mlist.WebAuthenticate(
+ [config.AuthUser], 'does not matter', 'aperson@dom.ain'))