Changeset 9842 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 8 Jan 2013, 07:52:55 (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
r9838 r9842 56 56 from waeup.kofa.university.department import ( 57 57 VirtualDepartmentExportJobContainer,) 58 from waeup.kofa.university.certificate import ( 59 VirtualCertificateExportJobContainer,) 58 60 from waeup.kofa.university.vocabularies import course_levels 59 61 from waeup.kofa.utils.batching import VirtualExportJobContainer … … 2724 2726 return None 2725 2727 2728 @property 2729 def certcode(self): 2730 return None 2731 2726 2732 def update(self, START=None, session=None, level=None, mode=None, 2727 2733 exporter=None): … … 2743 2749 current_level=level, 2744 2750 current_mode=mode, 2745 depcode=self.depcode) 2751 depcode=self.depcode, 2752 certcode=self.certcode) 2746 2753 ob_class = self.__implemented__.__name__.replace('waeup.kofa.','') 2747 2754 self.context.logger.info( 2748 '%s - exported: %s (%s, %s, %s, %s), job_id=%s' 2749 % (ob_class, exporter, session, level, mode, self.depcode, job_id)) 2755 '%s - exported: %s (%s, %s, %s, %s, %s), job_id=%s' 2756 % (ob_class, exporter, session, level, mode, self.depcode, 2757 self.certcode, job_id)) 2750 2758 self.flash(_('Export started for students with') + 2751 2759 ' current_session=%s, current_level=%s, study_mode=%s' % ( … … 2777 2785 def depcode(self): 2778 2786 return self.context.__parent__.code 2787 2788 class CertificateExportJobContainerJobConfig(ExportJobContainerJobConfig): 2789 """Page that configures a students export job for certificates. 2790 2791 """ 2792 grok.context(VirtualCertificateExportJobContainer) 2793 2794 @property 2795 def certcode(self): 2796 return self.context.__parent__.code -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9837 r9842 2776 2776 self.assertTrue( 2777 2777 'zope.mgr - students.browser.DepartmentExportJobContainerJobConfig ' 2778 '- exported: students (2004, 100, ug_ft, dep1), job_id=' 2778 '- exported: students (2004, 100, ug_ft, dep1, None), job_id=%s' 2779 % job_id in logcontent 2779 2780 ) 2780 2781 self.assertTrue( 2781 2782 'zope.mgr - students.browser.ExportJobContainerDownload ' 2782 2783 '- downloaded: WAeUP.Kofa_students_%s.csv, job_id=%s' 2783 % (job_id, job_id) 2784 % (job_id, job_id) in logcontent 2784 2785 ) 2785 2786 self.assertTrue( 2786 2787 'zope.mgr - students.browser.ExportJobContainerOverview ' 2787 '- discarded: job_id=%s' % job_id 2788 '- discarded: job_id=%s' % job_id in logcontent 2788 2789 ) 2790 2791 def test_certificate_export(self): 2792 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 2793 cert1_path = 'http://localhost/app/faculties/fac1/dep1/certificates/CERT1' 2794 self.browser.open(cert1_path) 2795 self.browser.getLink("Export student data").click() 2796 self.browser.getControl("Configure new export").click() 2797 self.browser.getControl(name="exporter").value = ['students'] 2798 self.browser.getControl(name="session").value = ['2004'] 2799 self.browser.getControl(name="level").value = ['100'] 2800 self.browser.getControl(name="mode").value = ['ug_ft'] 2801 self.browser.getControl("Create CSV file").click() 2802 2803 # When the job is finished and we reload the page... 2804 job_id = self.wait_for_export_job_completed() 2805 self.browser.open(cert1_path + '/exports') 2806 # ... the csv file can be downloaded ... 2807 self.browser.getLink("Download").click() 2808 self.assertEqual(self.browser.headers['content-type'], 2809 'text/csv; charset=UTF-8') 2810 self.assertTrue( 2811 'filename="WAeUP.Kofa_students_%s.csv' % job_id in 2812 self.browser.headers['content-disposition']) 2813 self.assertEqual(len(self.app['datacenter'].running_exports), 1) 2814 job_id = self.app['datacenter'].running_exports[0][0] 2815 # ... and discarded 2816 self.browser.open(cert1_path + '/exports') 2817 self.browser.getControl("Discard").click() 2818 self.assertEqual(len(self.app['datacenter'].running_exports), 0) 2819 # Creation, downloading and discarding is logged 2820 logfile = os.path.join( 2821 self.app['datacenter'].storage, 'logs', 'datacenter.log') 2822 logcontent = open(logfile).read() 2823 self.assertTrue( 2824 'zope.mgr - students.browser.CertificateExportJobContainerJobConfig ' 2825 '- exported: students (2004, 100, ug_ft, None, CERT1), job_id=%s' 2826 % job_id in logcontent 2827 ) 2828 self.assertTrue( 2829 'zope.mgr - students.browser.ExportJobContainerDownload ' 2830 '- downloaded: WAeUP.Kofa_students_%s.csv, job_id=%s' 2831 % (job_id, job_id) in logcontent 2832 ) 2833 self.assertTrue( 2834 'zope.mgr - students.browser.ExportJobContainerOverview ' 2835 '- discarded: job_id=%s' % job_id in logcontent 2836 )
Note: See TracChangeset for help on using the changeset viewer.