Changeset 6714 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 12 Sep 2011, 08:27:14 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6702 r6714 34 34 from hurry.workflow.interfaces import IWorkflowInfo 35 35 from waeup.sirp.testing import ( 36 FunctionalLayer, FunctionalTestCase, remove_logger 36 FunctionalLayer, FunctionalTestCase, remove_logger, 37 remove_new_loggers, 37 38 ) 38 39 from waeup.sirp.app import University … … 97 98 self.history_student_path = self.student_path + '/history' 98 99 100 # Create 5 access codes with prefix'PWD' and cost 9.99 each 101 pin_container = self.app['accesscodes'] 102 pin_container.createBatch( 103 datetime.now(), 'some_userid', 'PWD', 9.99, 5) 104 pins = pin_container[pin_container.keys()[0]].values() 105 self.pins = [x.representation for x in pins] 106 self.existing_pin = self.pins[0] 107 parts = self.existing_pin.split('-')[1:] 108 self.existing_series, self.existing_number = parts 109 99 110 # Populate university 100 111 certificate = createObject('waeup.Certificate') … … 257 268 # Students can access their own objects 258 269 # and can perform actions 259 remove_ logger('waeup.sirp.app.students')270 remove_new_loggers(self.functional_old_loggers) 260 271 self.browser.open(self.login_path) 261 272 self.browser.getControl(name="form.login").value = self.test_student_id … … 285 296 self.assertEqual(self.browser.url, self.student_path) 286 297 self.assertTrue('You logged in' in self.browser.contents) 287 288 return 298 return 299 300 def test_setpassword(self): 301 # Set password for first-time access 302 # Add student with subobjects (done by addStudent) 303 student = Student() 304 student.reg_number = u'123456' 305 student.name = u'Klaus Tester' 306 test_student_id = self.app['students'].addStudent(student) 307 setpassword_path = 'http://localhost/app/setpassword' 308 student_path = 'http://localhost/app/students/%s' % test_student_id 309 self.browser.open(setpassword_path) 310 self.browser.getControl(name="form.acseries").value = self.existing_series 311 self.browser.getControl(name="form.acnumber").value = self.existing_number 312 self.browser.getControl(name="form.reg_number").value = '123456' 313 self.browser.getControl("Show").click() 314 self.assertMatches('...Password has been set. Your Student Id is...', 315 self.browser.contents) 316 # The student can login with the new credentials 317 self.browser.open(self.login_path) 318 self.browser.getControl(name="form.login").value = test_student_id 319 self.browser.getControl(name="form.password").value = self.existing_number 320 self.browser.getControl("Login").click() 321 self.assertEqual(self.browser.url, student_path) 322 self.assertTrue('You logged in' in self.browser.contents) 323 return
Note: See TracChangeset for help on using the changeset viewer.