Ignore:
Timestamp:
18 Nov 2013, 15:30:05 (11 years ago)
Author:
Henrik Bettermann
Message:

Use the customized interface when exporting Nigerian payment tickets.

File:
1 edited

Legend:

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

    r9704 r10757  
    77
    88from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
    9 from kofacustom.nigeria.students.export import NigeriaStudentsExporter
     9from kofacustom.nigeria.students.export import (
     10    NigeriaStudentsExporter, NigeriaStudentPaymentsExporter)
    1011from kofacustom.nigeria.testing import FunctionalLayer
    1112
     
    7374        return
    7475
     76class NigeriaStudentPaymentsExporterTest(StudentImportExportSetup):
    7577
     78    layer = FunctionalLayer
     79
     80    def setUp(self):
     81        super(NigeriaStudentPaymentsExporterTest, self).setUp()
     82        self.setup_for_export()
     83        return
     84
     85    def test_ifaces(self):
     86        # make sure we fullfill interface contracts
     87        obj = NigeriaStudentPaymentsExporter()
     88        verifyObject(ICSVExporter, obj)
     89        verifyClass(ICSVExporter, NigeriaStudentPaymentsExporter)
     90        return
     91
     92    def test_export_all(self):
     93        # we can really export students
     94        # set values we can expect in export file
     95        self.setup_student(self.student)
     96        self.student['payments']['my-payment'].r_company = 'interswatch'
     97        self.student['payments']['my-payment'].r_card_num = '789'
     98        exporter = NigeriaStudentPaymentsExporter()
     99        exporter.export_all(self.app, self.outfile)
     100        result = open(self.outfile, 'rb').read()
     101        self.assertMatches(
     102            'ac,amount_auth,creation_date,gateway_amt,p_category,p_current,'
     103            'p_id,p_item,p_level,p_session,p_state,payment_date,provider_amt,'
     104            'r_amount_approved,r_card_num,r_code,r_company,r_desc,'
     105            'r_pay_reference,thirdparty_amt,student_id,state,'
     106            'current_session\r\n'
     107            '666,12.12,2012-04-01 13:12:01,,schoolfee,1,my-id,p-item,'
     108            '100,2012,paid,2012-04-01 14:12:01,,12.12,'
     109            '789,r-code,interswatch,,,,A111111,created,2012\r\n',
     110            result
     111            )
     112        return
Note: See TracChangeset for help on using the changeset viewer.