Index: main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py	(revision 17762)
+++ main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py	(revision 17766)
@@ -12,5 +12,5 @@
 from waeup.kofa.applicants.export import (
     ApplicantsContainerExporter, ApplicantExporter,
-    ApplicantPaymentExporter)
+    ApplicantPaymentExporter,  ApplicantRefereeReportExporter)
 from waeup.kofa.applicants.interfaces import (
     AppCatSource, ApplicationTypeSource)
@@ -331,2 +331,86 @@
             '123456,Anna M. Tester\r\n' % cdate, result)
         return
+
+class ApplicantRefereeReportExporterTest(ApplicantImportExportSetup):
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(ApplicantRefereeReportExporterTest, self).setUp()
+        self.outfile = os.path.join(self.workdir, 'myoutput.csv')
+        self.cat = getUtility(ICatalog, name='applicants_catalog')
+        self.intids = getUtility(IIntIds)
+        return
+
+    def test_ifaces(self):
+        # make sure we fullfill interface contracts
+        obj = ApplicantRefereeReportExporter()
+        verifyObject(ICSVExporter, obj)
+        verifyClass(ICSVExporter, ApplicantRefereeReportExporter)
+        return
+
+    def test_get_as_utility(self):
+        # we can get an applicant exporter as utility
+        result = queryUtility(ICSVExporter, name="applicantrefereereports")
+        self.assertTrue(result is not None)
+        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'
+        # Add payment
+        report = createObject(u'waeup.ApplicantRefereeReport')
+        report.r_id = 'r120'
+        report.name = u'John Doe'
+        report.email = 'xx@xx.xx'
+        applicant['r120'] = report
+        return applicant
+
+    def test_export(self):
+        applicant = self.setup_applicant(self.applicant)
+        exporter = ApplicantRefereeReportExporter()
+        exporter.export(applicant.refereereports, self.outfile)
+        result = open(self.outfile, 'rb').read()
+        cdate = str('%s#' % self.applicant['r120'].creation_date)
+        self.assertEqual(
+            'creation_date,email,email_pref,name,phone,r_id,report,'
+            'applicant_id,reg_number,display_fullname\r\n'
+            '%s,xx@xx.xx,aa@aa.aa,John Doe,,r120,,dp2011_654321,'
+            '123456,Anna M. Tester\r\n' % cdate, result)
+        return
+
+    def test_export_all(self):
+        self.applicant = self.setup_applicant(self.applicant)
+        exporter = ApplicantRefereeReportExporter()
+        exporter.export_all(self.app, self.outfile)
+        result = open(self.outfile, 'rb').read()
+        cdate = str('%s#' % self.applicant['r120'].creation_date)
+        self.assertEqual(
+            'creation_date,email,email_pref,name,phone,r_id,report,'
+            'applicant_id,reg_number,display_fullname\r\n'
+            '%s,xx@xx.xx,aa@aa.aa,John Doe,,r120,,dp2011_654321,'
+            '123456,Anna M. Tester\r\n' % cdate, result)
+        return
+
+    def test_export_filtered(self):
+        self.applicant = self.setup_applicant(self.applicant)
+        exporter = ApplicantRefereeReportExporter()
+        exporter.export_filtered(
+            self.app, self.outfile, container=self.container.code)
+        result = open(self.outfile, 'rb').read()
+        cdate = str('%s#' % self.applicant['r120'].creation_date)
+        self.assertEqual(
+            'creation_date,email,email_pref,name,phone,r_id,report,'
+            'applicant_id,reg_number,display_fullname\r\n'
+            '%s,xx@xx.xx,aa@aa.aa,John Doe,,r120,,dp2011_654321,'
+            '123456,Anna M. Tester\r\n' % cdate, result)
+        return
+
