diff MoinMoin/_tests/test_user.py @ 3103:4ede355c6089

bugfix for renaming of users (/MoinMoinBugs/RenamingUserAllowsOldUsernameToLogin) (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 23 Feb 2008 19:43:26 +0100
parents c61cd68592c2
children a7c1680aeaa0
line wrap: on
line diff
--- a/MoinMoin/_tests/test_user.py	Sat Feb 23 16:14:04 2008 +0100
+++ b/MoinMoin/_tests/test_user.py	Sat Feb 23 19:43:26 2008 +0100
@@ -158,6 +158,25 @@
         theUser = user.User(self.request, name=name, password=password)
         theUser.subscribe(pagename)
         assert not theUser.isSubscribedTo([testPagename]) # list(!) of pages to check
+        
+    def testRenameUser(self):
+        """ create user and then rename user and check
+        if the old username is removed from the cache name2id
+        """
+        # Create test user
+        # Use iso charset to create user with old enc_password, as if
+        # the user file was migrated from pre 1.3 wiki.
+        name = u'__Some Name__'
+        password = name
+        self.createUser(name, password)
+        # Login - this should replace the old password in the user file
+        theUser = user.User(self.request, name=name)
+        # Rename user
+        theUser.name = u'__SomeName__'
+        theUser.save()
+        theUser = user.User(self.request, name=name, password=password)
+        
+        assert not theUser.exists()
 
     # Helpers ---------------------------------------------------------