Changeset 6694 for main/waeup.sirp/trunk/src/waeup/sirp/students/tests
- Timestamp:
- 8 Sep 2011, 16:35:05 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6667 r6694 39 39 from waeup.sirp.university.faculty import Faculty 40 40 from waeup.sirp.university.department import Department 41 from waeup.sirp.interfaces import IUserAccount 41 42 42 43 PH_LEN = 2059 # Length of placeholder file … … 75 76 student.name = u'Anna Tester' 76 77 self.test_student_id = self.app['students'].addStudent(student) 77 78 # Set password 79 IUserAccount(self.app['students'][self.test_student_id]).setPassword('spwd') 80 81 self.login_path = 'http://localhost/app/login' 78 82 self.container_path = 'http://localhost/app/students' 79 83 self.manage_container_path = self.container_path + '/@@manage' … … 244 248 self.assertMatches('...Student admitted by zope.mgr...', 245 249 self.browser.contents) 246 247 return 250 return 251 252 def test_student_access(self): 253 # Students can access their own objects 254 # and can perform actions 255 256 self.browser.open(self.login_path) 257 self.browser.getControl(name="form.login").value = self.test_student_id 258 self.browser.getControl(name="form.password").value = 'spwd' 259 self.browser.getControl("Login").click() 260 self.assertEqual(self.browser.url, self.student_path) 261 self.assertTrue('You logged in' in self.browser.contents) 262 # Change password 263 self.browser.getLink("Change password").click() 264 self.browser.getControl(name="form.password").value = 'new_password' 265 self.browser.getControl("Save").click() 266 self.assertTrue('Form has been saved' in self.browser.contents) 267 # We are still logged in. Changing the password hasn't thrown us out. 268 self.browser.getLink("My Data").click() 269 self.assertEqual(self.browser.url, self.student_path) 270 # We can logout 271 self.browser.getLink("Logout").click() 272 self.assertTrue('You have been logged out' in self.browser.contents) 273 self.assertEqual(self.browser.url, 'http://localhost/app') 274 # We can login again with the new password 275 self.browser.getLink("Login").click() 276 #self.browser.open(self.login_path) 277 self.browser.getControl(name="form.login").value = self.test_student_id 278 self.browser.getControl(name="form.password").value = 'new_password' 279 self.browser.getControl("Login").click() 280 self.assertEqual(self.browser.url, self.student_path) 281 self.assertTrue('You logged in' in self.browser.contents) 282 return
Note: See TracChangeset for help on using the changeset viewer.