Changeset 11773 for main/waeup.uniben/trunk/src/waeup/uniben
- Timestamp:
- 31 Jul 2014, 05:14:19 (10 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r11611 r11773 766 766 'finger1.fpm deleted' 767 767 in self.browser.contents) 768 769 def test_handle_clearance_by_co(self): 770 # Create clearance officer 771 self.app['users'].addUser('mrclear', 'mrclearsecret') 772 self.app['users']['mrclear'].email = 'mrclear@foo.ng' 773 self.app['users']['mrclear'].title = 'Carlo Pitter' 774 department = self.app['faculties']['fac1']['dep1'] 775 prmlocal = IPrincipalRoleManager(department) 776 prmlocal.assignRoleToPrincipal('waeup.local.ClearanceOfficer', 'mrclear') 777 notify(LocalRoleSetEvent( 778 department, 'waeup.local.ClearanceOfficer', 'mrclear', granted=True)) 779 IWorkflowState(self.student).setState('clearance requested') 780 # Login as clearance officer 781 self.browser.open(self.login_path) 782 self.browser.getControl(name="form.login").value = 'mrclear' 783 self.browser.getControl(name="form.password").value = 'mrclearsecret' 784 self.browser.getControl("Login").click() 785 self.assertMatches('...You logged in...', self.browser.contents) 786 # CO can view the student ... 787 self.browser.open(self.clearance_path) 788 self.assertEqual(self.browser.headers['Status'], '200 Ok') 789 self.assertEqual(self.browser.url, self.clearance_path) 790 # Clearance is disabled for this session for ug students ... 791 self.browser.open(self.clearance_path) 792 self.assertFalse('Clear student' in self.browser.contents) 793 self.browser.open(self.student_path + '/clear') 794 self.assertTrue('Clearance is disabled for this session' 795 in self.browser.contents) 796 # ... but not for 797 self.certificate.study_mode = 'pg_ft' 798 self.browser.open(self.clearance_path) 799 self.assertTrue('Clear student' in self.browser.contents) 800 self.browser.open(self.student_path + '/clear') 801 self.assertTrue('Student has been cleared' in self.browser.contents) -
main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
r11644 r11773 16 16 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 ## 18 import grok 18 19 from time import time 19 20 from zope.component import createObject, getUtility … … 232 233 return 50 233 234 235 def clearance_disabled_message(self, student): 236 if student.is_postgrad: 237 return None 238 try: 239 session_config = grok.getSite()[ 240 'configuration'][str(student.current_session)] 241 except KeyError: 242 return _('Session configuration object is not available.') 243 if not session_config.clearance_enabled: 244 return _('Clearance is disabled for this session.') 245 return None 246 234 247 # Uniben prefix 235 248 STUDENT_ID_PREFIX = u'B'
Note: See TracChangeset for help on using the changeset viewer.