Changeset 10757 for main/kofacustom.nigeria/trunk/src/kofacustom
- Timestamp:
- 18 Nov 2013, 15:30:05 (11 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/export.py
r9860 r10757 19 19 """ 20 20 from kofacustom.nigeria.students.interfaces import ( 21 INigeriaStudent, INigeriaStudentStudyCourse, INigeriaCourseTicket) 21 INigeriaStudent, INigeriaStudentStudyCourse, INigeriaCourseTicket, 22 INigeriaStudentOnlinePayment) 22 23 from waeup.kofa.students.export import ( 23 StudentsExporter, StudentStudyCourseExporter, CourseTicketExporter) 24 StudentsExporter, StudentStudyCourseExporter, CourseTicketExporter, 25 StudentPaymentsExporter) 24 26 from waeup.kofa.utils.helpers import iface_names 25 27 … … 57 59 fields = tuple(sorted(iface_names(INigeriaCourseTicket) + 58 60 ['level', 'code', 'level_session'])) + ('student_id', 'certcode') 61 62 class NigeriaStudentPaymentsExporter(StudentPaymentsExporter): 63 """Exporter for OnlinePayment instances. 64 """ 65 66 #: Fieldnames considered by this exporter 67 fields = tuple( 68 sorted(iface_names( 69 INigeriaStudentOnlinePayment, exclude_attribs=False, 70 omit=['display_item']))) + ( 71 'student_id','state','current_session') -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_export.py
r9704 r10757 7 7 8 8 from kofacustom.nigeria.utils.utils import NigeriaKofaUtils 9 from kofacustom.nigeria.students.export import NigeriaStudentsExporter 9 from kofacustom.nigeria.students.export import ( 10 NigeriaStudentsExporter, NigeriaStudentPaymentsExporter) 10 11 from kofacustom.nigeria.testing import FunctionalLayer 11 12 … … 73 74 return 74 75 76 class NigeriaStudentPaymentsExporterTest(StudentImportExportSetup): 75 77 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.