- Timestamp:
- 14 Sep 2011, 10:46:18 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6762 r6767 713 713 IWorkflowInfo(self.context).fireTransition('start_clearance') 714 714 self.flash('Clearance process is started.') 715 self.redirect(self.url(self.context ))716 return 715 self.redirect(self.url(self.context,'cedit')) 716 return -
main/waeup.sirp/trunk/src/waeup/sirp/students/student.py
r6764 r6767 34 34 """ 35 35 grok.implements(IStudent, IStudentNavigation, 36 IStudentPersonalEdit )36 IStudentPersonalEdit, IStudentClearanceEdit) 37 37 grok.provides(IStudent) 38 38 -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6766 r6767 30 30 from zope.security.interfaces import Unauthorized 31 31 from zope.testbrowser.testing import Browser 32 from hurry.workflow.interfaces import IWorkflowInfo 32 33 from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase 33 34 from waeup.sirp.app import University … … 94 95 self.history_student_path = self.student_path + '/history' 95 96 96 # Create 5 access codes with prefix'PWD' and cost 9.99 each97 # Create 5 access codes with prefix'PWD' 97 98 pin_container = self.app['accesscodes'] 98 99 pin_container.createBatch( 99 100 datetime.now(), 'some_userid', 'PWD', 9.99, 5) 100 101 pins = pin_container[pin_container.keys()[0]].values() 101 self.pins = [x.representation for x in pins] 102 self.existing_pin = self.pins[0] 103 parts = self.existing_pin.split('-')[1:] 104 self.existing_series, self.existing_number = parts 102 self.pwdpins = [x.representation for x in pins] 103 self.existing_pwdpin = self.pwdpins[0] 104 parts = self.existing_pwdpin.split('-')[1:] 105 self.existing_pwdseries, self.existing_pwdnumber = parts 106 # Create 5 access codes with prefix 'CLR' 107 pin_container.createBatch( 108 datetime.now(), 'some_userid', 'CLR', 9.99, 5) 109 pins = pin_container[pin_container.keys()[0]].values() 110 self.clrpins = [x.representation for x in pins] 111 self.existing_clrpin = self.clrpins[0] 112 self.existing_clrpin 113 parts = self.existing_clrpin.split('-')[1:] 114 self.existing_clrseries, self.existing_clrnumber = parts 105 115 106 116 # Populate university … … 310 320 return 311 321 312 def test_student_access(self): 313 # Students can access their own objects 314 # and can perform actions 322 def test_student_change_password(self): 323 # Students can change the password 315 324 self.browser.open(self.login_path) 316 325 self.browser.getControl(name="form.login").value = self.test_student_id … … 350 359 def test_setpassword(self): 351 360 # Set password for first-time access 352 # Add student with subobjects (done by addStudent)353 361 student = Student() 354 362 student.reg_number = u'123456' … … 358 366 student_path = 'http://localhost/app/students/%s' % test_student_id 359 367 self.browser.open(setpassword_path) 360 self.browser.getControl(name="ac_series").value = self.existing_ series361 self.browser.getControl(name="ac_number").value = self.existing_ number368 self.browser.getControl(name="ac_series").value = self.existing_pwdseries 369 self.browser.getControl(name="ac_number").value = self.existing_pwdnumber 362 370 self.browser.getControl(name="reg_number").value = '123456' 363 371 self.browser.getControl("Show").click() … … 368 376 self.browser.getControl(name="form.login").value = test_student_id 369 377 self.browser.getControl( 370 name="form.password").value = self.existing_ number378 name="form.password").value = self.existing_pwdnumber 371 379 self.browser.getControl("Login").click() 372 380 self.assertEqual(self.browser.url, student_path) 373 381 self.assertTrue('You logged in' in self.browser.contents) 374 382 return 383 384 def test_student_access(self): 385 # Students can access their own objects 386 # and can perform actions 387 student = self.app['students'][self.test_student_id] 388 IWorkflowInfo(student).fireTransition('admit') 389 self.browser.open(self.login_path) 390 self.browser.getControl(name="form.login").value = self.test_student_id 391 self.browser.getControl(name="form.password").value = 'spwd' 392 self.browser.getControl("Login").click() 393 # Student can view the clearance data 394 self.browser.getLink("Clearance Data").click() 395 # Student can't open clearance edit form before starting clearance 396 self.browser.open(self.student_path + '/cedit') 397 self.assertMatches('...The requested form is locked...', 398 self.browser.contents) 399 self.browser.getLink("Clearance Data").click() 400 self.browser.getLink("Start clearance").click() 401 self.browser.getControl(name="ac_series").value = self.existing_clrseries 402 self.browser.getControl(name="ac_number").value = self.existing_clrnumber 403 self.browser.getControl("Start").click() 404 self.assertMatches('...Clearance process is started...', 405 self.browser.contents) 406 self.browser.getControl(name="form.date_of_birth").value = '09/10/1961' 407 self.browser.getControl("Save", index=0).click() 408 # Student can view the clearance data 409 self.browser.getLink("Clearance Data").click() 410 # and go back to the edit form 411 self.browser.getLink("Edit").click() 412 self.browser.getControl("Save and request clearance").click() 413 self.assertMatches('...Clearance has been requested...', 414 self.browser.contents) 415 # Student can't reopen clearance form after requesting clearance 416 self.browser.open(self.student_path + '/cedit') 417 self.assertMatches('...The requested form is locked...', 418 self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.