[Zope-CVS] CVS: Products/PluggableAuthService/plugins/tests -
test_ZODBUserManager.py:1.4
Zachery Bir
zbir at urbanape.com
Mon Aug 30 11:31:11 EDT 2004
Update of /cvs-repository/Products/PluggableAuthService/plugins/tests
In directory cvs.zope.org:/tmp/cvs-serv20542
Modified Files:
test_ZODBUserManager.py
Log Message:
Test authentication with old-style passwords (just
sha.sha().hexdigest()) so that they can peacefully co-exist with
new-style passwords (using AccessControl.AuthEncoding)
=== Products/PluggableAuthService/plugins/tests/test_ZODBUserManager.py 1.3 => 1.4 ===
--- Products/PluggableAuthService/plugins/tests/test_ZODBUserManager.py:1.3 Thu Aug 12 11:15:55 2004
+++ Products/PluggableAuthService/plugins/tests/test_ZODBUserManager.py Mon Aug 30 11:31:11 2004
@@ -324,5 +324,39 @@
self.failUnless( info[ 'id' ] in SUBSET_IDS )
self.failUnless( info[ 'login' ] in SUBSET_LOGINS )
+ def test_authenticateWithOldPasswords( self ):
+
+ import sha
+
+ zum = self._makeOne()
+
+ # synthesize an older account
+
+ old_password = sha.sha( 'old_password' ).hexdigest()
+ zum._user_passwords[ 'old_user' ] = old_password
+ zum._login_to_userid[ 'old_user at example.com' ] = 'old_user'
+ zum._userid_to_login[ 'old_user' ] = 'old_user at example.com'
+
+ # create a new user
+
+ zum.addUser( 'new_user', 'new_user at example.com', 'new_password' )
+
+ user_id, login = zum.authenticateCredentials(
+ { 'login' : 'old_user at example.com'
+ , 'password' : 'old_password'
+ } )
+
+ self.assertEqual( user_id, 'old_user' )
+ self.assertEqual( login, 'old_user at example.com' )
+
+ user_id, login = zum.authenticateCredentials(
+ { 'login' : 'new_user at example.com'
+ , 'password' : 'new_password'
+ } )
+
+ self.assertEqual( user_id, 'new_user' )
+ self.assertEqual( login, 'new_user at example.com' )
+
+
if __name__ == "__main__":
unittest.main()
More information about the Zope-CVS
mailing list