[Zope-Checkins]
SVN: Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py
Forward-port tests for collector #1926 from 2.8 branch.
Tres Seaver
tseaver at palladion.com
Fri Oct 21 02:59:12 EDT 2005
Log message for revision 39547:
Forward-port tests for collector #1926 from 2.8 branch.
Changed:
U Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py
-=-
Modified: Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py 2005-10-21 06:56:48 UTC (rev 39546)
+++ Zope/trunk/lib/python/AccessControl/tests/testUserFolder.py 2005-10-21 06:59:12 UTC (rev 39547)
@@ -206,7 +206,39 @@
except OverflowError:
assert 0, "Raised overflow error erroneously"
+ def test__doAddUser_with_not_yet_encrypted_passwords(self):
+ # See collector #1869 && #1926
+ from AccessControl.AuthEncoding import pw_validate
+ USER_ID = 'not_yet_encrypted'
+ PASSWORD = 'password'
+
+ uf = UserFolder().__of__(self.app)
+ uf.encrypt_passwords = True
+ self.failIf(uf._isPasswordEncrypted(PASSWORD))
+
+ uf._doAddUser(USER_ID, PASSWORD, [], [])
+ user = uf.getUserById(USER_ID)
+ self.failUnless(uf._isPasswordEncrypted(user.__))
+ self.failUnless(pw_validate(user.__, PASSWORD))
+
+ def test__doAddUser_with_preencrypted_passwords(self):
+ # See collector #1869 && #1926
+ from AccessControl.AuthEncoding import pw_validate
+
+ USER_ID = 'already_encrypted'
+ PASSWORD = 'password'
+
+ uf = UserFolder().__of__(self.app)
+ uf.encrypt_passwords = True
+ ENCRYPTED = uf._encryptPassword(PASSWORD)
+
+ uf._doAddUser(USER_ID, ENCRYPTED, [], [])
+ user = uf.getUserById(USER_ID)
+ self.assertEqual(user.__, ENCRYPTED)
+ self.failUnless(uf._isPasswordEncrypted(user.__))
+ self.failUnless(pw_validate(user.__, PASSWORD))
+
class UserTests(unittest.TestCase):
def testGetUserName(self):
More information about the Zope-Checkins
mailing list