changeset 5740:51240cc99af5

Add new tests for user auth with migrated passwords (ARP1, MD5, DES)
author pavel_vinogradov
date Tue, 30 Nov 2010 21:57:25 +0300
parents 1b4b3f510f9b
children 62875f1ab006
files MoinMoin/_tests/test_user.py
diffstat 1 files changed, 45 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_user.py	Tue Nov 30 21:37:54 2010 +0300
+++ b/MoinMoin/_tests/test_user.py	Tue Nov 30 21:57:25 2010 +0300
@@ -93,6 +93,51 @@
         # Try to "login"
         theUser = user.User(self.request, name=name, password=password)
         assert theUser.valid
+
+    def test_auth_with_apr1_stored_password(self):
+        """
+        Create user with {APR1} password and check that user can login.
+        """
+        # Create test user
+        name = u'Test User'
+        password = '{APR1}$apr1$salt$kKtoJ6r.fd87EWbzq2TiF0' # 12345
+        self.createUser(name, password, True)
+        
+        # Try to "login"
+        theuser = user.User(self.request, name=name, password='12345')
+        assert theuser.valid
+
+    def test_auth_with_md5_stored_password(self):
+        """
+        Create user with {MD5} password and check that user can login.
+        """
+        # Create test user
+        name = u'Test User'
+        password = '{MD5}$1$salt$etVYf53ma13QCiRbQOuRk/' # 12345
+        self.createUser(name, password, True)
+        
+        # Try to "login"
+        theuser = user.User(self.request, name=name, password='12345')
+        assert theuser.valid
+
+    #This test is disabled because require crypt, which not 
+    #presented on some platforms
+    def test_auth_with_des_stored_password(self):
+        """
+        Create user with {DES} password and check that user can login.
+        """
+        # Create test user
+        name = u'Test User'
+        password = '{DES}sajEeYaHYyeSU' # 12345
+        self.createUser(name, password, True)
+        
+        try:
+            import crypt
+            # Try to "login"
+            theuser = user.User(self.request, name=name, password='12345')
+            assert theuser.valid
+        except ImportError:
+            crypt = None            
         
     def testSubscriptionSubscribedPage(self):
         """ user: tests isSubscribedTo  """