- Timestamp:
- 21 Nov 2011, 09:17:23 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7147 r7158 32 32 from zope.component.hooks import setSite, clearSite 33 33 from zope.security.interfaces import Unauthorized 34 from zope.securitypolicy.interfaces import IPrincipalRoleManager 34 35 from zope.testbrowser.testing import Browser 35 36 from hurry.workflow.interfaces import IWorkflowInfo … … 642 643 in self.browser.contents) 643 644 return 645 646 def test_handle_clearance_by_co(self): 647 # Create clearance officer 648 self.app['users'].addUser('mrclear', 'mrclearsecret') 649 prmglobal = IPrincipalRoleManager(self.app) 650 prmglobal.assignRoleToPrincipal('waeup.StudentsOfficer', 'mrclear') 651 prmlocal = IPrincipalRoleManager(self.app['faculties']['fac1']['dep1']) 652 prmlocal.assignRoleToPrincipal('waeup.local.ClearanceOfficer', 'mrclear') 653 IWorkflowInfo(self.student).fireTransition('admit') 654 IWorkflowInfo(self.student).fireTransition('start_clearance') 655 # Login as clearance officer 656 self.browser.open(self.login_path) 657 self.browser.getControl(name="form.login").value = 'mrclear' 658 self.browser.getControl(name="form.password").value = 'mrclearsecret' 659 self.browser.getControl("Login").click() 660 self.assertTrue('You logged in' in self.browser.contents) 661 self.browser.open(self.clearance_student_path) 662 self.assertEqual(self.browser.headers['Status'], '200 Ok') 663 self.assertEqual(self.browser.url, self.clearance_student_path) 664 # Only in state clearance requested the co does see the 'Clear' button 665 self.assertFalse('Clear student' in self.browser.contents) 666 IWorkflowInfo(self.student).fireTransition('request_clearance') 667 self.browser.open(self.clearance_student_path) 668 self.assertTrue('Clear student' in self.browser.contents) 669 self.browser.getLink("Clear student").click() 670 self.assertTrue('Student has been cleared' in self.browser.contents) 671 self.assertTrue('State: <span>cleared</span>' in self.browser.contents) 672 self.browser.getLink("Reject clearance").click() 673 self.assertTrue('Clearance has been annulled' in self.browser.contents) 674 self.assertTrue('State: <span>clearance started</span>' 675 in self.browser.contents) 676 IWorkflowInfo(self.student).fireTransition('request_clearance') 677 self.browser.open(self.clearance_student_path) 678 self.browser.getLink("Reject clearance").click() 679 self.assertTrue('Clearance request has been rejected' 680 in self.browser.contents) 681 self.assertTrue('State: <span>clearance started</span>' 682 in self.browser.contents) 683 # The clearance officer can't clear students if not in state 684 # clearance requested 685 self.browser.open(self.student_path + '/clear') 686 self.assertTrue('Student is in the wrong state' 687 in self.browser.contents) 644 688 645 689 def test_student_change_password(self):
Note: See TracChangeset for help on using the changeset viewer.