Changeset 16186 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 4 Aug 2020, 07:49:51 (4 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r16120 r16186 3953 3953 'sex,student_id,suspended,suspended_comment,' 3954 3954 'password,state,history,certcode,is_postgrad,' 3955 'current_level,current_session \r\n'3955 'current_level,current_session,entry_session\r\n' 3956 3956 ',,1981-02-04#,aa@aa.ng,,Anna,,Tester,234,,,,,,,' 3957 3957 '1234#,123,m,K1000000,0,,{SSHA}' in self.browser.contents) … … 4084 4084 'sex,student_id,suspended,suspended_comment,' 4085 4085 'password,state,history,certcode,is_postgrad,' 4086 'current_level,current_session \r\n'4086 'current_level,current_session,entry_session\r\n' 4087 4087 ',,1981-02-04#,aa@aa.ng,,Anna,,Tester,234,,,,,,,' 4088 4088 '1234#,123,m,K1000000,0,,{SSHA}' in self.browser.contents) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r15979 r16186 168 168 'perm_address,personal_updated,' 169 169 'phone,reg_number,sex,student_id,suspended,suspended_comment,' 170 'password,state,history, '171 'c ertcode,is_postgrad,current_level,current_session\r\n'170 'password,state,history,certcode,is_postgrad,' 171 'current_level,current_session,entry_session\r\n' 172 172 'my adm code,my clr code,' 173 173 '1981-02-04#,anna@sample.com,,Anna,,Tester,234,M.,NG,,,' 174 174 '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,123,f,' 175 175 'A111111,0,,,created' 176 in result177 )178 return179 180 181 class StudentTrimmedDataExporterTest(StudentImportExportSetup):182 183 layer = FunctionalLayer184 185 std_csv_entry = (186 'my adm code,my clr code,1981-02-04#,anna@sample.com,,'187 'Anna,,Tester,234,M.,NG,,,"Studentroad 21\nLagos 123456\n",,'188 '+234-123-12345#,123,f,A111111,0,,,created'189 )190 191 def setUp(self):192 super(StudentTrimmedDataExporterTest, self).setUp()193 self.setup_for_export()194 return195 196 def test_ifaces(self):197 # make sure we fullfill interface contracts198 obj = TrimmedDataExporter()199 verifyObject(ICSVStudentExporter, obj)200 verifyClass(ICSVStudentExporter, TrimmedDataExporter)201 return202 203 def test_get_as_utility(self):204 # we can get an student exporter as utility205 result = queryUtility(ICSVExporter, name="trimmed")206 self.assertTrue(result is not None)207 return208 209 def test_export(self):210 # we can really export students211 # set values we can expect in export file212 self.setup_student(self.student)213 exporter = TrimmedDataExporter()214 exporter.export([self.student], self.outfile)215 result = open(self.outfile, 'rb').read()216 self.assertTrue(217 'student_id,matric_number,reg_number,firstname,middlename,'218 'lastname,sex,email,phone,nationality,date_of_birth,state,'219 'current_mode,certcode,faccode,depcode,current_level,'220 'current_session,current_verdict\r\n'221 'A111111,234,123,Anna,M.,Tester,f,anna@sample.com,+234-123-12345#,'222 'NG,1981-02-04#,created,ug_ft,CERT1,NA,NA,200,2012,0'223 176 in result 224 177 ) … … 238 191 'perm_address,personal_updated,' 239 192 'phone,reg_number,sex,student_id,suspended,suspended_comment,' 240 'password,state,history,certcode, '241 ' is_postgrad,current_level,current_session\r\n'193 'password,state,history,certcode,is_postgrad,' 194 'current_level,current_session,entry_session\r\n' 242 195 'my adm code,my clr code,1981-02-04#,anna@sample.com,,' 243 196 'Anna,,Tester,234,M.,NG,,,"Studentroad 21\nLagos 123456\n"' … … 259 212 'perm_address,personal_updated,' 260 213 'phone,reg_number,sex,student_id,suspended,suspended_comment,' 261 'password,state,history,certcode, '262 ' is_postgrad,current_level,current_session\r\n'214 'password,state,history,certcode,is_postgrad,' 215 'current_level,current_session,entry_session\r\n' 263 216 'my adm code,my clr code,1981-02-04#,anna@sample.com,,' 264 217 'Anna,,Tester,234,M.,NG,,,"Studentroad 21\nLagos 123456\n"' … … 373 326 self.assertTrue(self.std_csv_entry in result1) 374 327 self.assertTrue(self.std_csv_entry not in result2) 328 return 329 330 331 332 class StudentTrimmedDataExporterTest(StudentImportExportSetup): 333 334 layer = FunctionalLayer 335 336 std_csv_entry = ( 337 'my adm code,my clr code,1981-02-04#,anna@sample.com,,' 338 'Anna,,Tester,234,M.,NG,,,"Studentroad 21\nLagos 123456\n",,' 339 '+234-123-12345#,123,f,A111111,0,,,created' 340 ) 341 342 def setUp(self): 343 super(StudentTrimmedDataExporterTest, self).setUp() 344 self.setup_for_export() 345 return 346 347 def test_ifaces(self): 348 # make sure we fullfill interface contracts 349 obj = TrimmedDataExporter() 350 verifyObject(ICSVStudentExporter, obj) 351 verifyClass(ICSVStudentExporter, TrimmedDataExporter) 352 return 353 354 def test_get_as_utility(self): 355 # we can get an student exporter as utility 356 result = queryUtility(ICSVExporter, name="trimmed") 357 self.assertTrue(result is not None) 358 return 359 360 def test_export_all(self): 361 # we can really export students 362 # set values we can expect in export file 363 self.setup_student(self.student) 364 exporter = TrimmedDataExporter() 365 exporter.export_all(self.app, self.outfile) 366 result = open(self.outfile, 'rb').read() 367 self.assertTrue( 368 'student_id,matric_number,reg_number,firstname,middlename,' 369 'lastname,sex,email,phone,nationality,date_of_birth,state,' 370 'current_mode,certcode,faccode,depcode,current_level,' 371 'current_session,current_verdict,entry_session\r\n' 372 'A111111,234,123,Anna,M.,Tester,f,anna@sample.com,+234-123-12345#,' 373 'NG,1981-02-04#,created,ug_ft,CERT1,NA,NA,200,2012,0,2010' 374 in result 375 ) 375 376 return 376 377
Note: See TracChangeset for help on using the changeset viewer.