comparison MoinMoin/_tests/test_user.py @ 2038:bd83616af43a

test_user: tests for subscription of pages and subpages
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 20 May 2007 20:01:26 +0200
parents 1339d6fdc4ff
children ff428fa12e3c
comparison
equal deleted inserted replaced
2037:a63c473a100d 2038:bd83616af43a
134 # Login again - the password should be new unicode password 134 # Login again - the password should be new unicode password
135 expected = user.encodePassword(password) 135 expected = user.encodePassword(password)
136 theUser = user.User(self.request, name=name, password=password) 136 theUser = user.User(self.request, name=name, password=password)
137 self.assertEqual(theUser.enc_password, expected, 137 self.assertEqual(theUser.enc_password, expected,
138 "User password was not replaced with new") 138 "User password was not replaced with new")
139 139
140 def testSubscriptionSubscribedPage(self):
141 """ user: tests isSubscribedTo """
142 pagename = u'HelpMiscellaneous'
143 name = u'__Jürgen Herman__'
144 password = name
145 self.createUser(name, password, charset='iso-8859-1')
146 # Login - this should replace the old password in the user file
147 theUser = user.User(self.request, name=name, password=password)
148 theUser.subscribe(pagename)
149 expected = True
150 result = theUser.isSubscribedTo(pagename)
151 self.assertEqual(result, expected,
152 'Expected "%(expected)s" but got "%(result)s"' % locals())
153
154 def testSubscriptionSubPage(self):
155 """ user: tests isSubscribedTo on a subpage """
156 pagename = u'HelpMiscellaneous'
157 testPagename = u'HelpMiscellaneous/FrequentlyAskedQuestions'
158 name = u'__Jürgen Herman__'
159 password = name
160 self.createUser(name, password, charset='iso-8859-1')
161 # Login - this should replace the old password in the user file
162 theUser = user.User(self.request, name=name, password=password)
163 theUser.subscribe(pagename)
164 expected = False
165 result = theUser.isSubscribedTo(testPagename)
166 self.assertEqual(result, expected,
167 'Expected "%(expected)s" but got "%(result)s"' % locals())
168
140 # Helpers --------------------------------------------------------- 169 # Helpers ---------------------------------------------------------
141 170
142 def createUser(self, name, password, charset='utf-8'): 171 def createUser(self, name, password, charset='utf-8'):
143 """ helper to create test user 172 """ helper to create test user
144 173