Index: main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 10654)
+++ main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 10655)
@@ -28,4 +28,5 @@
 from datetime import datetime, date, timedelta
 from mechanize import LinkNotFoundError
+from zc.async.testing import wait_for_result
 from zope.event import notify
 from zope.catalog.interfaces import ICatalog
@@ -42,7 +43,8 @@
 from waeup.kofa.applicants.applicant import Applicant
 from waeup.kofa.interfaces import (
-    IExtFileStore, IFileStoreNameChooser, IUserAccount)
+    IExtFileStore, IFileStoreNameChooser, IUserAccount, IJobManager)
 from waeup.kofa.university.faculty import Faculty
 from waeup.kofa.university.department import Department
+from waeup.kofa.tests.test_async import FunctionalAsyncTestCase
 
 PH_LEN = 15911  # Length of placeholder file
@@ -1120,2 +1122,57 @@
             'An email with your user name and password has been sent'
             in self.browser.contents)
+
+class ApplicantsExportTests(ApplicantsFullSetup, FunctionalAsyncTestCase):
+    # Tests for StudentsContainer class views and pages
+
+    layer = FunctionalLayer
+
+    def wait_for_export_job_completed(self):
+        # helper function waiting until the current export job is completed
+        manager = getUtility(IJobManager)
+        job_id = self.app['datacenter'].running_exports[0][0]
+        job = manager.get(job_id)
+        wait_for_result(job)
+        return job_id
+
+    def test_applicants_in_container_export(self):
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        container_path = 'http://localhost/app/applicants/app2011'
+        self.browser.open(container_path)
+        self.browser.getLink("Export applicants").click()
+        self.browser.getControl("Start new export").click()
+
+        # When the job is finished and we reload the page...
+        job_id = self.wait_for_export_job_completed()
+        self.browser.open(container_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_applicants_%s.csv' % job_id in
+            self.browser.headers['content-disposition'])
+        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
+        job_id = self.app['datacenter'].running_exports[0][0]
+        # ... and discarded
+        self.browser.open(container_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 - applicants.browser.ExportJobContainerJobStart - '
+            'exported: applicants (app2011), job_id=%s'
+            % job_id in logcontent
+            )
+        self.assertTrue(
+            'zope.mgr - applicants.browser.ExportJobContainerDownload '
+            '- downloaded: WAeUP.Kofa_applicants_%s.csv, job_id=%s'
+            % (job_id, job_id) in logcontent
+            )
+        self.assertTrue(
+            'zope.mgr - applicants.browser.ExportJobContainerOverview '
+            '- discarded: job_id=%s' % job_id in logcontent
+            )
