Changeset 15966 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 29 Jan 2020, 08:52:54 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r15963 r15966 38 38 AccommodationPaymentsExporter, 39 39 TranscriptDataExporter, 40 TrimmedDataExporter, 40 41 get_students,) 41 42 from waeup.kofa.students.accommodation import BedTicket … … 172 173 '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,123,f,' 173 174 'A111111,0,,,created' 175 in result 176 ) 177 return 178 179 180 class StudentTrimmedDataExporterTest(StudentImportExportSetup): 181 182 layer = FunctionalLayer 183 184 std_csv_entry = ( 185 'my adm code,my clr code,1981-02-04#,anna@sample.com,,' 186 'Anna,,Tester,234,M.,NG,,,"Studentroad 21\nLagos 123456\n",,' 187 '+234-123-12345#,123,f,A111111,0,,,created' 188 ) 189 190 def setUp(self): 191 super(StudentTrimmedDataExporterTest, self).setUp() 192 self.setup_for_export() 193 return 194 195 def test_ifaces(self): 196 # make sure we fullfill interface contracts 197 obj = TrimmedDataExporter() 198 verifyObject(ICSVStudentExporter, obj) 199 verifyClass(ICSVStudentExporter, TrimmedDataExporter) 200 return 201 202 def test_get_as_utility(self): 203 # we can get an student exporter as utility 204 result = queryUtility(ICSVExporter, name="trimmed") 205 self.assertTrue(result is not None) 206 return 207 208 def test_export(self): 209 # we can really export students 210 # set values we can expect in export file 211 self.setup_student(self.student) 212 exporter = TrimmedDataExporter() 213 exporter.export([self.student], self.outfile) 214 result = open(self.outfile, 'rb').read() 215 self.assertTrue( 216 'student_id,matric_number,reg_number,firstname,middlename,' 217 'lastname,sex,email,phone,nationality,date_of_birth,state,' 218 'current_mode,certcode,faccode,depcode,current_level,' 219 'current_session,current_verdict\r\n' 220 'A111111,234,123,Anna,M.,Tester,f,anna@sample.com,+234-123-12345#,' 221 'NG,1981-02-04#,created,ug_ft,CERT1,NA,NA,200,2012,0' 174 222 in result 175 223 )
Note: See TracChangeset for help on using the changeset viewer.