comparison 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
comparison
equal deleted inserted replaced
3102:a78bf6977df8 3103:4ede355c6089
156 self.createUser(name, password, charset='iso-8859-1') 156 self.createUser(name, password, charset='iso-8859-1')
157 # Login - this should replace the old password in the user file 157 # Login - this should replace the old password in the user file
158 theUser = user.User(self.request, name=name, password=password) 158 theUser = user.User(self.request, name=name, password=password)
159 theUser.subscribe(pagename) 159 theUser.subscribe(pagename)
160 assert not theUser.isSubscribedTo([testPagename]) # list(!) of pages to check 160 assert not theUser.isSubscribedTo([testPagename]) # list(!) of pages to check
161
162 def testRenameUser(self):
163 """ create user and then rename user and check
164 if the old username is removed from the cache name2id
165 """
166 # Create test user
167 # Use iso charset to create user with old enc_password, as if
168 # the user file was migrated from pre 1.3 wiki.
169 name = u'__Some Name__'
170 password = name
171 self.createUser(name, password)
172 # Login - this should replace the old password in the user file
173 theUser = user.User(self.request, name=name)
174 # Rename user
175 theUser.name = u'__SomeName__'
176 theUser.save()
177 theUser = user.User(self.request, name=name, password=password)
178
179 assert not theUser.exists()
161 180
162 # Helpers --------------------------------------------------------- 181 # Helpers ---------------------------------------------------------
163 182
164 def createUser(self, name, password, charset='utf-8'): 183 def createUser(self, name, password, charset='utf-8'):
165 """ helper to create test user 184 """ helper to create test user