Ignore:
Timestamp:
5 Apr 2012, 14:49:02 (13 years ago)
Author:
uli
Message:

Fix and extend applicant exporter tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py

    r8008 r8047  
    127127        return applicant
    128128
     129    def test_export_emtpy(self):
     130        # we can export nearly empty applicants
     131        self.applicant.applicant_id = u'dp2011_654321'
     132        exporter = ApplicantsExporter()
     133        exporter.export([self.applicant], self.outfile)
     134        result = open(self.outfile, 'rb').read()
     135        self.assertEqual(
     136            result,
     137            'applicant_id,course1,course2,course_admitted,date_of_birth,'
     138            'email,firstname,lastname,lga,middlename,notice,phone,'
     139            'reg_number,screening_score,screening_venue,sex\r\n'
     140
     141            'dp2011_654321,,,,,,Anna,Tester,foreigner,,,,,,,\r\n'
     142            )
     143        return
     144
    129145    def test_export(self):
    130146        # we can really export applicants
     
    138154            'applicant_id,course1,course2,course_admitted,date_of_birth,'
    139155            'email,firstname,lastname,lga,middlename,notice,phone,'
    140             'reg_number,school_grades,screening_score,screening_venue,'
     156            'reg_number,screening_score,screening_venue,'
    141157            'sex\r\n'
    142158
    143159            'dp2011_654321,CERT1,CERT1,CERT1,1981-02-04,anna@sample.com,'
    144160            'Anna,Tester,foreigner,M.,"Some notice\nin lines.",'
    145             '+234-123-12345,123456,'
    146             '"[(\'computer_science\', \'A\')]",98,Exam Room,f\r\n'
     161            '+234-123-12345,123456,98,Exam Room,f\r\n'
    147162            )
    148163        return
     164
     165    def test_export_all(self):
     166        # we can export all applicants in a portal
     167        # set values we can expect in export file
     168        self.applicant = self.setup_applicant(self.applicant)
     169        exporter = ApplicantsExporter()
     170        exporter.export_all(self.app, self.outfile)
     171        result = open(self.outfile, 'rb').read()
     172        self.assertEqual(
     173            result,
     174            'applicant_id,course1,course2,course_admitted,date_of_birth,'
     175            'email,firstname,lastname,lga,middlename,notice,phone,'
     176            'reg_number,screening_score,screening_venue,'
     177            'sex\r\n'
     178
     179            'dp2011_654321,CERT1,CERT1,CERT1,1981-02-04,anna@sample.com,'
     180            'Anna,Tester,foreigner,M.,"Some notice\nin lines.",'
     181            '+234-123-12345,123456,98,Exam Room,f\r\n'
     182            )
     183        return
Note: See TracChangeset for help on using the changeset viewer.