Changeset 10247 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 29 May 2013, 06:29:51 (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
r10179 r10247 56 56 from waeup.kofa.university.department import ( 57 57 VirtualDepartmentExportJobContainer,) 58 from waeup.kofa.university.facultiescontainer import ( 59 VirtualFacultiesExportJobContainer, FacultiesContainer) 58 60 from waeup.kofa.university.certificate import ( 59 61 VirtualCertificateExportJobContainer,) … … 2878 2880 exporters.append((util.title, name),) 2879 2881 self.exporters = exporters 2882 return 2880 2883 2881 2884 @property … … 2938 2941 grok.context(IDataCenter) 2939 2942 redirect_target = '@@export' 2943 2944 class FacultiesExportJobContainerJobConfig(ExportJobContainerJobConfig): 2945 """Page that configures a students export job in facultiescontainer. 2946 2947 """ 2948 grok.context(VirtualFacultiesExportJobContainer) 2949 2950 def _set_exporter_values(self): 2951 # Only Bursary Officers will use this export. They must 2952 # not be allowed to export regular student data at faculties level 2953 self.exporters = [('Bursary Data', 'bursary')] 2954 return 2940 2955 2941 2956 class DepartmentExportJobContainerJobConfig(ExportJobContainerJobConfig): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r10178 r10247 2879 2879 return job_id 2880 2880 2881 def test_faculties_export(self): 2882 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 2883 facs_path = 'http://localhost/app/faculties' 2884 self.browser.open(facs_path) 2885 self.browser.getLink("Export student data").click() 2886 self.browser.getControl("Configure new export").click() 2887 # Only the bursary exporter us available ot this level 2888 self.assertFalse('<option value="students">' in self.browser.contents) 2889 self.assertTrue('<option value="bursary">' in self.browser.contents) 2890 self.browser.getControl(name="exporter").value = ['bursary'] 2891 self.browser.getControl(name="session").value = ['2004'] 2892 self.browser.getControl(name="level").value = ['100'] 2893 self.browser.getControl(name="mode").value = ['ug_ft'] 2894 self.browser.getControl("Create CSV file").click() 2895 2896 # When the job is finished and we reload the page... 2897 job_id = self.wait_for_export_job_completed() 2898 self.browser.open(facs_path + '/exports') 2899 # ... the csv file can be downloaded ... 2900 self.browser.getLink("Download").click() 2901 self.assertEqual(self.browser.headers['content-type'], 2902 'text/csv; charset=UTF-8') 2903 self.assertTrue( 2904 'filename="WAeUP.Kofa_bursary_%s.csv' % job_id in 2905 self.browser.headers['content-disposition']) 2906 self.assertEqual(len(self.app['datacenter'].running_exports), 1) 2907 job_id = self.app['datacenter'].running_exports[0][0] 2908 # ... and discarded 2909 self.browser.open(facs_path + '/exports') 2910 self.browser.getControl("Discard").click() 2911 self.assertEqual(len(self.app['datacenter'].running_exports), 0) 2912 # Creation, downloading and discarding is logged 2913 logfile = os.path.join( 2914 self.app['datacenter'].storage, 'logs', 'datacenter.log') 2915 logcontent = open(logfile).read() 2916 self.assertTrue( 2917 'zope.mgr - students.browser.FacultiesExportJobContainerJobConfig ' 2918 '- exported: bursary (2004, 100, ug_ft, None, None), job_id=%s' 2919 % job_id in logcontent 2920 ) 2921 self.assertTrue( 2922 'zope.mgr - students.browser.ExportJobContainerDownload ' 2923 '- downloaded: WAeUP.Kofa_bursary_%s.csv, job_id=%s' 2924 % (job_id, job_id) in logcontent 2925 ) 2926 self.assertTrue( 2927 'zope.mgr - students.browser.ExportJobContainerOverview ' 2928 '- discarded: job_id=%s' % job_id in logcontent 2929 ) 2930 2881 2931 def test_department_export(self): 2882 2932 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
Note: See TracChangeset for help on using the changeset viewer.