Changeset 10279 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 6 Jun 2013, 05:15:00 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r10278 r10279 2961 2961 def _set_exporter_values(self): 2962 2962 # We provide all student exporters, nothing else, yet. 2963 # Bursary Officers don't have the general exportData permission 2964 # and are only allowed to export bursary data. 2963 # Bursary or Department Officers don't have the general exportData 2964 # permission and are only allowed to export bursary or payments 2965 # overview data respectively. This is the only place where 2966 # waeup.exportBursaryData and waeup.exportPaymentsOverview 2967 # are used. 2968 exporters = [] 2965 2969 if not checkPermission('waeup.exportData', self.context): 2966 self.exporters = [('Bursary Data', 'bursary')] 2967 return 2968 exporters = [] 2970 if checkPermission('waeup.exportBursaryData', self.context): 2971 exporters += [('Bursary Data', 'bursary')] 2972 if checkPermission('waeup.exportPaymentsOverview', self.context): 2973 exporters += [('Student Payments Overview', 'paymentsoverview')] 2974 self.exporters = exporters 2975 return 2969 2976 for name in EXPORTER_NAMES: 2970 2977 util = getUtility(ICSVExporter, name=name) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r10278 r10279 3183 3183 ) 3184 3184 3185 def test_export_departmet_officers(self): 3186 # Create department officer 3187 self.app['users'].addUser('mrdepartment', 'mrdepartmentsecret') 3188 self.app['users']['mrdepartment'].email = 'mrdepartment@foo.ng' 3189 self.app['users']['mrdepartment'].title = 'Carlo Pitter' 3190 # Assign local role 3191 department = self.app['faculties']['fac1']['dep1'] 3192 prmlocal = IPrincipalRoleManager(department) 3193 prmlocal.assignRoleToPrincipal('waeup.local.DepartmentOfficer', 'mrdepartment') 3194 # Login as department officer 3195 self.browser.open(self.login_path) 3196 self.browser.getControl(name="form.login").value = 'mrdepartment' 3197 self.browser.getControl(name="form.password").value = 'mrdepartmentsecret' 3198 self.browser.getControl("Login").click() 3199 self.assertMatches('...You logged in...', self.browser.contents) 3200 self.browser.open("http://localhost/app/faculties/fac1/dep1") 3201 self.browser.getLink("Export student data").click() 3202 self.browser.getControl("Configure new export").click() 3203 # Only the paymentsoverview exporter is available for department officers 3204 self.assertFalse('<option value="students">' in self.browser.contents) 3205 self.assertTrue( 3206 '<option value="paymentsoverview">' in self.browser.contents) 3207 self.browser.getControl(name="exporter").value = ['paymentsoverview'] 3208 self.browser.getControl(name="session").value = ['2004'] 3209 self.browser.getControl(name="level").value = ['100'] 3210 self.browser.getControl("Create CSV file").click() 3211 self.assertTrue('Export started' in self.browser.contents) 3212 # Thew job can be discarded 3213 self.assertEqual(len(self.app['datacenter'].running_exports), 1) 3214 #job_id = self.app['datacenter'].running_exports[0][0] 3215 job_id = self.wait_for_export_job_completed() 3216 self.browser.open("http://localhost/app/faculties/fac1/dep1/exports") 3217 self.browser.getControl("Discard").click() 3218 self.assertEqual(len(self.app['datacenter'].running_exports), 0) 3219 3185 3220 def test_export_bursary_officers(self): 3186 3221 # Create bursary officer
Note: See TracChangeset for help on using the changeset viewer.