Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 12623)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 12632)
@@ -3299,5 +3299,5 @@
         self.assertTrue(
             'zope.mgr - students.browser.DatacenterExportJobContainerJobConfig '
-            '- exported: bursary (2004, 100, ug_ft, None, None, '
+            '- exported: bursary (2004, 100, ug_ft, None, None, None, '
             '13/12/2012, 14/12/2012), job_id=%s'
             % job_id in logcontent
@@ -3389,5 +3389,5 @@
         self.assertTrue(
             'zope.mgr - students.browser.FacultiesExportJobContainerJobConfig '
-            '- exported: bursary (2004, 100, ug_ft, None, None, '
+            '- exported: bursary (2004, 100, ug_ft, None, None, None, '
             '13/12/2012, 14/12/2012), job_id=%s'
             % job_id in logcontent
@@ -3396,4 +3396,65 @@
             'zope.mgr - students.browser.ExportJobContainerDownload '
             '- downloaded: WAeUP.Kofa_bursary_%s.csv, job_id=%s'
+            % (job_id, job_id) in logcontent
+            )
+        self.assertTrue(
+            'zope.mgr - students.browser.ExportJobContainerOverview '
+            '- discarded: job_id=%s' % job_id in logcontent
+            )
+
+    def test_faculty_export(self):
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        fac1_path = 'http://localhost/app/faculties/fac1'
+        self.browser.open(fac1_path)
+        self.browser.getLink("Export student data").click()
+        self.browser.getControl("Configure new export").click()
+        self.browser.getControl(name="exporter").value = ['students']
+        self.browser.getControl(name="session").value = ['2004']
+        self.browser.getControl(name="level").value = ['100']
+        self.browser.getControl(name="mode").value = ['ug_ft']
+        # The testbrowser does not hide the payment period fields, but
+        # values are ignored when using the students exporter.
+        self.browser.getControl(name="payments_start").value = '13/12/2012'
+        self.browser.getControl(name="payments_end").value = '14/12/2012'
+        self.browser.getControl("Create CSV file").click()
+
+        # When the job is finished and we reload the page...
+        job_id = self.wait_for_export_job_completed()
+        self.browser.open(fac1_path + '/exports')
+        # ... the csv file can be downloaded ...
+        self.browser.getLink("Download").click()
+        self.assertEqual(self.browser.headers['content-type'],
+            'text/csv; charset=UTF-8')
+        self.assertTrue(
+            'filename="WAeUP.Kofa_students_%s.csv' % job_id in
+            self.browser.headers['content-disposition'])
+        self.assertTrue(
+            'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
+            'firstname,lastname,matric_number,middlename,nationality,'
+            'officer_comment,perm_address,personal_updated,phone,reg_number,'
+            'sex,student_id,suspended,suspended_comment,transcript_comment,'
+            'password,state,history,certcode,is_postgrad,current_level,'
+            'current_session\r\n'
+            ',1,,1981-02-04#,aa@aa.ng,,Anna,Tester,234,,,,,,'
+            '1234#,123,m,K1000000,0,,,{SSHA}' in self.browser.contents)
+        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
+        job_id = self.app['datacenter'].running_exports[0][0]
+        # ... and discarded
+        self.browser.open(fac1_path + '/exports')
+        self.browser.getControl("Discard").click()
+        self.assertEqual(len(self.app['datacenter'].running_exports), 0)
+        # Creation, downloading and discarding is logged
+        logfile = os.path.join(
+            self.app['datacenter'].storage, 'logs', 'datacenter.log')
+        logcontent = open(logfile).read()
+        self.assertTrue(
+            'zope.mgr - students.browser.FacultyExportJobContainerJobConfig '
+            '- exported: students (2004, 100, ug_ft, fac1, None, None, '
+            '13/12/2012, 14/12/2012), job_id=%s'
+            % job_id in logcontent
+            )
+        self.assertTrue(
+            'zope.mgr - students.browser.ExportJobContainerDownload '
+            '- downloaded: WAeUP.Kofa_students_%s.csv, job_id=%s'
             % (job_id, job_id) in logcontent
             )
@@ -3441,5 +3502,5 @@
         self.assertTrue(
             'zope.mgr - students.browser.DepartmentExportJobContainerJobConfig '
-            '- exported: students (2004, 100, ug_ft, dep1, None, '
+            '- exported: students (2004, 100, ug_ft, None, dep1, None, '
             '13/12/2012, 14/12/2012), job_id=%s'
             % job_id in logcontent
@@ -3488,5 +3549,5 @@
         self.assertTrue(
             'zope.mgr - students.browser.CertificateExportJobContainerJobConfig '
-            '- exported: students (2004, 100, None, None, CERT1, None, None), '
+            '- exported: students (2004, 100, None, None, None, CERT1, None, None), '
             'job_id=%s'
             % job_id in logcontent
