Changeset 14622 for main/waeup.aaue/trunk
- Timestamp:
- 13 Mar 2017, 11:52:24 (8 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/export.py
r14595 r14622 50 50 51 51 fields = tuple( 52 sorted(iface_names(ICustomStudentStudyCourse))) + ('student_id',) 52 sorted(iface_names(ICustomStudentStudyCourse))) + ( 53 'matric_number', 'state', 'student_id',) 54 55 def mangle_value(self, value, name, context=None): 56 if name == 'certificate' and value is not None: 57 # XXX: hopefully cert codes are unique site-wide 58 value = value.code 59 if name in ('student_id', 'matric_number', 'state') and context is not None: 60 student = context.student 61 value = getattr(student, name, None) 62 return ExporterBase().mangle_value(value, name, context=context) 53 63 54 64 class CustomCourseTicketExporter(NigeriaCourseTicketExporter): -
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_export.py
r14595 r14622 11 11 CustomStudentStudyLevelExporter, 12 12 CustomCourseTicketExporter, 13 LevelReportDataExporter) 13 LevelReportDataExporter, 14 CustomStudentStudyCourseExporter) 14 15 from waeup.aaue.testing import FunctionalLayer 15 16 … … 122 123 return 123 124 125 class CustomStudentStudyCourseExporterTest(StudentImportExportSetup): 126 127 layer = FunctionalLayer 128 129 def setUp(self): 130 super(CustomStudentStudyCourseExporterTest, self).setUp() 131 self.setup_for_export() 132 return 133 134 def test_export_all(self): 135 self.setup_student(self.student) 136 exporter = CustomStudentStudyCourseExporter() 137 exporter.export_all(self.app, self.outfile) 138 result = open(self.outfile, 'rb').read() 139 self.assertEqual( 140 result, 141 'certificate,current_level,current_session,current_verdict,' 142 'entry_mode,entry_session,imported_cgpa,previous_verdict,' 143 'matric_number,state,student_id\r\n' 144 'CERT1,200,2012,0,ug_ft,2010,,0,234,created,A111111\r\n' 145 ) 146 return 147 148 124 149 class CustomStudentStudyLevelExporterTest(StudentImportExportSetup): 125 150
Note: See TracChangeset for help on using the changeset viewer.