Changeset 13569 for main/waeup.aaue/trunk
- Timestamp:
- 6 Jan 2016, 08:21:17 (9 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
r12876 r13569 18 18 """Exporters for student related stuff. 19 19 """ 20 from waeup.kofa.utils.batching import ExporterBase 20 21 from waeup.aaue.students.interfaces import ( 21 22 ICustomStudent, ICustomStudentStudyCourse, … … 51 52 fields = tuple(sorted(iface_names(ICustomCourseTicket) + 52 53 ['level', 'code', 'level_session'])) + ('student_id', 53 'certcode', 'display_fullname') 54 'certcode', 'display_fullname', 'matric_number') 55 56 def mangle_value(self, value, name, context=None): 57 """The mangler determines the student's id and fullname. 58 """ 59 if context is not None: 60 student = context.student 61 if name in ('student_id', 'display_fullname', 'matric_number') \ 62 and student is not None: 63 value = getattr(student, name, None) 64 return ExporterBase().mangle_value(value, name, context=context) 54 65 55 66 class CustomStudentStudyLevelExporter(NigeriaStudentStudyLevelExporter): -
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_export.py
r13351 r13569 8 8 from waeup.aaue.students.export import ( 9 9 CustomStudentExporter, CustomStudentPaymentExporter, 10 CustomStudentStudyLevelExporter) 10 CustomStudentStudyLevelExporter, 11 CustomCourseTicketExporter) 11 12 from waeup.aaue.testing import FunctionalLayer 12 13 … … 141 142 return 142 143 144 class CustomCourseTicketExporterTest(StudentImportExportSetup): 145 146 layer = FunctionalLayer 147 148 def setUp(self): 149 super(CustomCourseTicketExporterTest, self).setUp() 150 self.setup_for_export() 151 return 152 153 def test_export_all(self): 154 # we can really export all course tickets 155 # set values we can expect in export file 156 self.setup_student(self.student) 157 exporter = CustomCourseTicketExporter() 158 exporter.export_all(self.app, self.outfile) 159 result = open(self.outfile, 'rb').read() 160 self.assertEqual( 161 result, 162 'automatic,carry_over,code,credits,dcode,fcode,level,level_session,' 163 'mandatory,passmark,score,semester,title,student_id,certcode,' 164 'display_fullname,matric_number\r\n' 165 '1,1,CRS1,100,DEP1,FAC1,100,2012,0,100,,2,Course 1,A111111,CERT1,' 166 'Anna M. Tester,234\r\n' 167 ) 168 return 169
Note: See TracChangeset for help on using the changeset viewer.