diff options
| author | Barry Warsaw | 2011-04-08 22:05:33 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-04-08 22:05:33 -0400 |
| commit | 5de5904af6dd97339a70630002d64c901b008c98 (patch) | |
| tree | e9c01a2bd38587226745043b47106de1ac5efb84 /src/mailman/app/tests/test_membership.py | |
| parent | 0a58c7a9f2fe97665fba102eea9287b28575de5c (diff) | |
| parent | 25b407e24fe21dc46a4f9efa77734d55e0ed4bdd (diff) | |
| download | mailman-5de5904af6dd97339a70630002d64c901b008c98.tar.gz mailman-5de5904af6dd97339a70630002d64c901b008c98.tar.zst mailman-5de5904af6dd97339a70630002d64c901b008c98.zip | |
Diffstat (limited to 'src/mailman/app/tests/test_membership.py')
| -rw-r--r-- | src/mailman/app/tests/test_membership.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mailman/app/tests/test_membership.py b/src/mailman/app/tests/test_membership.py index b0e1bae5d..2b69c7f39 100644 --- a/src/mailman/app/tests/test_membership.py +++ b/src/mailman/app/tests/test_membership.py @@ -31,6 +31,7 @@ from zope.component import getUtility from mailman.app.lifecycle import create_list from mailman.app.membership import add_member +from mailman.config import config from mailman.core.constants import system_preferences from mailman.interfaces.bans import IBanManager from mailman.interfaces.member import DeliveryMode, MembershipIsBannedError @@ -125,7 +126,34 @@ class AddMemberTest(unittest.TestCase): +class AddMemberPasswordTest(unittest.TestCase): + layer = ConfigLayer + + def setUp(self): + self._mlist = create_list('test@example.com') + # The default ssha scheme introduces a random salt, which is + # inappropriate for unit tests. + config.push('password scheme', """ + [passwords] + password_scheme: sha + """) + + def tearDown(self): + config.pop('password scheme') + reset_the_world() + + def test_add_member_password(self): + # Test that the password stored with the new user is encrypted. + member = add_member(self._mlist, 'anne@example.com', + 'Anne Person', 'abc', DeliveryMode.regular, + system_preferences.preferred_language) + self.assertEqual( + member.user.password, '{SHA}qZk-NkcGgWq6PiVxeFDCbJzQ2J0=') + + + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(AddMemberTest)) + suite.addTest(unittest.makeSuite(AddMemberPasswordTest)) return suite |
