Ignore:
Timestamp:
29 May 2013, 06:29:51 (12 years ago)
Author:
Henrik Bettermann
Message:

Enable bursary data export at facultiescontainer level.

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  
    5656from waeup.kofa.university.department import (
    5757    VirtualDepartmentExportJobContainer,)
     58from waeup.kofa.university.facultiescontainer import (
     59    VirtualFacultiesExportJobContainer, FacultiesContainer)
    5860from waeup.kofa.university.certificate import (
    5961    VirtualCertificateExportJobContainer,)
     
    28782880            exporters.append((util.title, name),)
    28792881        self.exporters = exporters
     2882        return
    28802883
    28812884    @property
     
    29382941    grok.context(IDataCenter)
    29392942    redirect_target = '@@export'
     2943
     2944class 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
    29402955
    29412956class DepartmentExportJobContainerJobConfig(ExportJobContainerJobConfig):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r10178 r10247  
    28792879        return job_id
    28802880
     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
    28812931    def test_department_export(self):
    28822932        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
Note: See TracChangeset for help on using the changeset viewer.