Changeset 8289 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 26 Apr 2012, 14:30:24 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r8287 r8289 81 81 '\n')[0].split(',') 82 82 83 STUDENT_SAMPLE_DATA_DUPLICATES = open( 84 os.path.join(os.path.dirname(__file__), 'sample_student_data_duplicates.csv'), 85 'rb').read() 86 87 STUDENT_HEADER_FIELDS_DUPLICATES = STUDENT_SAMPLE_DATA_DUPLICATES.split( 88 '\n')[0].split(',') 89 83 90 STUDYLEVEL_SAMPLE_DATA = open( 84 91 os.path.join(os.path.dirname(__file__), 'sample_studylevel_data.csv'), … … 174 181 self.csv_file_migration = os.path.join( 175 182 self.workdir, 'sample_student_data_migration.csv') 183 self.csv_file_duplicates = os.path.join( 184 self.workdir, 'sample_student_data_duplicates.csv') 176 185 open(self.csv_file, 'wb').write(STUDENT_SAMPLE_DATA) 177 186 open(self.csv_file_update, 'wb').write(STUDENT_SAMPLE_DATA_UPDATE) 178 187 open(self.csv_file_update2, 'wb').write(STUDENT_SAMPLE_DATA_UPDATE2) 179 188 open(self.csv_file_migration, 'wb').write(STUDENT_SAMPLE_DATA_MIGRATION) 189 open(self.csv_file_duplicates, 'wb').write(STUDENT_SAMPLE_DATA_DUPLICATES) 180 190 181 191 def tearDown(self): … … 321 331 shutil.rmtree(os.path.dirname(fin_file)) 322 332 333 def test_import_duplicate_data(self): 334 num, num_warns, fin_file, fail_file = self.processor.doImport( 335 self.csv_file_duplicates, STUDENT_HEADER_FIELDS_DUPLICATES) 336 content = open(fail_file).read() 337 self.assertEqual(num_warns,3) 338 self.assertEqual( 339 content, 340 'reg_number,firstname,student_id,sex,email,phone,state,date_of_birth,lastname,password,matric_number,--ERRORS--\r\n' 341 '1,Aaren,B123456,m,aa@aa.ng,1234,cleared,1990-01-03,Finau,mypw1,100001,reg_number: reg_number\r\n' 342 '2,Aaren,C123456,m,aa@aa.ng,1234,admitted,1990-01-04,Berson,mypw1,100000,matric_number: matric_number\r\n' 343 '1,Frank,F123456,m,aa@aa.ng,1234,,1990-01-06,Meyer,,100000,reg_number: reg_number; matric_number: matric_number\r\n' 344 ) 345 shutil.rmtree(os.path.dirname(fin_file)) 323 346 324 347 class StudentStudyCourseProcessorTest(StudentImportExportSetup):
Note: See TracChangeset for help on using the changeset viewer.