Ignore:
Timestamp:
11 Aug 2020, 12:34:08 (4 years ago)
Author:
Henrik Bettermann
Message:

Customize TrimmedDataExporter?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_export.py

    r15731 r16195  
    2626from kofacustom.nigeria.students.export import (
    2727    NigeriaStudentExporter, NigeriaStudentPaymentExporter,
    28     ClearanceRequestedStudentExporter, NigeriaDataForBursaryExporter)
     28    ClearanceRequestedStudentExporter, NigeriaDataForBursaryExporter,
     29    NigeriaTrimmedDataExporter)
    2930from kofacustom.nigeria.testing import FunctionalLayer
    3031
     
    200201            )
    201202        return
     203
     204class NigeriaStudentTrimmedDataExporterTest(StudentImportExportSetup):
     205
     206    layer = FunctionalLayer
     207
     208    std_csv_entry = (
     209        'my adm code,my clr code,1981-02-04#,anna@sample.com,,'
     210        'Anna,,Tester,234,M.,NG,,,"Studentroad 21\nLagos 123456\n",,'
     211        '+234-123-12345#,123,f,A111111,0,,,created'
     212        )
     213
     214    def setUp(self):
     215        super(NigeriaStudentTrimmedDataExporterTest, self).setUp()
     216        self.setup_for_export()
     217        self.student.lga = 'abia_aba_north'
     218        return
     219
     220    def test_export_all(self):
     221        # we can really export students
     222        # set values we can expect in export file
     223        self.setup_student(self.student)
     224        exporter = NigeriaTrimmedDataExporter()
     225        exporter.export_all(self.app, self.outfile)
     226        result = open(self.outfile, 'rb').read()
     227        self.assertTrue(
     228            'student_id,matric_number,reg_number,firstname,middlename,'
     229            'lastname,sex,email,phone,nationality,date_of_birth,state,'
     230            'current_mode,certcode,faccode,depcode,current_level,'
     231            'current_session,current_verdict,entry_session,lg_state,lg_area\r\n'
     232            'A111111,234,123,Anna,M.,Tester,f,anna@sample.com,+234-123-12345#,'
     233            'NG,1981-02-04#,created,ug_ft,CERT1,NA,NA,200,2012,0,2010,'
     234            'abia,aba-north'
     235            in result
     236            )
     237        return
Note: See TracChangeset for help on using the changeset viewer.