Index: main/waeup.uniben/trunk/src/waeup/uniben/applicants/export.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/applicants/export.py	(revision 8056)
+++ main/waeup.uniben/trunk/src/waeup/uniben/applicants/export.py	(revision 8056)
@@ -0,0 +1,33 @@
+## $Id$
+##
+## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+"""Exporters for applicant-related stuff.
+"""
+import grok
+from waeup.kofa.applicants.interfaces import IApplicantBaseData
+from waeup.kofa.applicants.export import ApplicantsExporter
+from waeup.uniben.applicants.interfaces import IUGApplicant, IPGApplicant
+
+class ApplicantsExporter(ApplicantsExporter):
+    """Exporter for Uniben Applicants.
+    """
+
+    fields = tuple(sorted(set(
+        IUGApplicant.names() +
+        IPGApplicant.names() +
+        IApplicantBaseData.names()
+        )))
Index: main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests.py	(revision 8055)
+++ main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests.py	(revision 8056)
@@ -19,7 +19,10 @@
 import shutil
 import tempfile
+import datetime
+from zope.intid.interfaces import IIntIds
 from zope.interface.verify import verifyClass, verifyObject
 from zope.component.hooks import setSite, clearSite
-from zope.component import createObject
+from zope.component import createObject, getUtility
+from zope.catalog.interfaces import ICatalog
 from zope.testbrowser.testing import Browser
 from waeup.kofa.app import University
@@ -28,6 +31,9 @@
 from waeup.kofa.testing import FunctionalTestCase
 from waeup.kofa.applicants.container import ApplicantsContainer
+from waeup.kofa.applicants.tests.test_batching import ApplicantImportExportSetup
+from waeup.kofa.interfaces import IBatchProcessor
 from waeup.uniben.testing import FunctionalLayer
-from waeup.kofa.interfaces import IBatchProcessor
+from waeup.uniben.applicants.export import ApplicantsExporter
+
 
 class ApplicantUITest(FunctionalTestCase):
@@ -145,2 +151,58 @@
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
         return
+
+class ApplicantsExporterTest(ApplicantImportExportSetup):
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(ApplicantsExporterTest, self).setUp()
+        self.outfile = os.path.join(self.workdir, 'myoutput.csv')
+        self.cat = getUtility(ICatalog, name='applicants_catalog')
+        self.intids = getUtility(IIntIds)
+        return
+
+    def setup_applicant(self, applicant):
+        # set predictable values for `applicant`
+        applicant.reg_number = u'123456'
+        applicant.applicant_id = u'dp2011_654321'
+        applicant.firstname = u'Anna'
+        applicant.lastname = u'Tester'
+        applicant.middlename = u'M.'
+        applicant.date_of_birth = datetime.date(1981, 2, 4)
+        applicant.sex = 'f'
+        applicant.email = 'anna@sample.com'
+        applicant.phone = u'+234-123-12345'
+        applicant.course1 = self.certificate
+        applicant.course2 = self.certificate
+        applicant.course_admitted = self.certificate
+        applicant.notice = u'Some notice\nin lines.'
+        applicant.screening_score = 98
+        applicant.screening_venue = u'Exam Room'
+        applicant.password = 'any password'
+        return applicant
+
+    def test_export_all(self):
+        # we can export all applicants in a portal
+        # set values we can expect in export file
+        self.applicant = self.setup_applicant(self.applicant)
+        exporter = ApplicantsExporter()
+        exporter.export_all(self.app, self.outfile)
+        result = open(self.outfile, 'rb').read()
+        # The exported records do contain a real date in their
+        # history dict. We skip the date and split the comparison
+        # into two parts.
+        self.assertTrue(
+            'applicant_id,application_date,application_number,course1,course2,'
+            'course_admitted,date_of_birth,display_fullname,email,emp2_end,'
+            'emp2_position,emp2_reason,emp2_start,emp_end,emp_position,emp_reason,'
+            'emp_start,employer,employer2,firstname,history,hq_degree,hq_disc,'
+            'hq_matric_no,hq_school,hq_session,hq_type,lastname,lga,locked,'
+            'middlename,notice,password,perm_address,phone,pp_school,reg_number,'
+            'screening_score,screening_venue,sex,state,student_id'
+            in result)
+        self.assertTrue(
+            'Application initialized by system\'],,,,,,,Tester,foreigner,0,M.,'
+            '"Some notice\nin lines.",any password,,+234-123-12345,,123456,98,'
+            'Exam Room,f,initialized,' in result)
+        return
