Changeset 8202 for main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Timestamp:
- 18 Apr 2012, 05:12:32 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_applicant_data.csv
r7984 r8202 1 container_code,reg_number,firstname,lastname,date_of_birth,email,course1,sex 2 dp2011,1001,Aaren,Pieri,1990-01-02,xx@yy.zz,CERT1,m 3 dp2011,1002,Aaren,Finau,1990-01-03,xx@yy.zz,CERT1,m 4 dp2011,1003,Aaren,Berson,1990-01-04,xx@yy.zz,CERT1,m 1 container_code,reg_number,firstname,lastname,date_of_birth,email,course1,sex,middlename 2 dp2011,1001,Aaren,Pieri,1990-01-02,xx@yy.zz,CERT1,m,Peter 3 dp2011,1002,Aaren,Finau,1990-01-03,xx@yy.zz,CERT1,m,Claus 4 dp2011,1003,Aaren,Berson,1990-01-04,xx@yy.zz,CERT1,m,Alfons -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_applicant_data_update.csv
r7270 r8202 1 container_code,reg_number,firstname 2 dp2011,1001,Aaren 3 dp2011,1002,Alfons 4 dp2011,1003,Abraham 1 container_code,reg_number,firstname,middlename 2 dp2011,1001,Aaren, 3 dp2011,1002,Alfons, 4 dp2011,1003,Abraham, -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_faulty_applicant_data.csv
r7984 r8202 1 container_code,reg_number,firstname,lastname,date_of_birth,email,course1,sex 2 dp2011,1001,Aaren,Pieri,01/02/1990,xx@yy.zz,CERT1,m 1 container_code,reg_number,firstname,lastname,date_of_birth,email,course1,sex,middlename 2 dp2011,1001,Aaren,Pieri,01/02/1990,xx@yy.zz,CERT1,m,Claus -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_batching.py
r8200 r8202 48 48 '\n')[0].split(',') 49 49 50 # The same for students50 # The same for applicants 51 51 APPLICANT_SAMPLE_DATA = open( 52 52 os.path.join(os.path.dirname(__file__), 'sample_applicant_data.csv'), … … 56 56 'sample_faulty_applicant_data.csv'), 'rb').read() 57 57 58 59 58 APPLICANT_HEADER_FIELDS = APPLICANT_SAMPLE_DATA.split( 60 59 '\n')[0].split(',') … … 63 62 os.path.join(os.path.dirname(__file__), 64 63 'sample_applicant_data_update.csv'), 'rb').read() 64 65 APPLICANT_SAMPLE_DATA_UPDATE2 = open( 66 os.path.join(os.path.dirname(__file__), 67 'sample_applicant_data_update2.csv'), 'rb').read() 65 68 66 69 APPLICANT_HEADER_FIELDS_UPDATE = APPLICANT_SAMPLE_DATA_UPDATE.split( … … 231 234 self.csv_file_update = os.path.join( 232 235 self.workdir, 'sample_applicant_data_update.csv') 236 self.csv_file_update2 = os.path.join( 237 self.workdir, 'sample_applicant_data_update2.csv') 233 238 open(self.csv_file, 'wb').write(APPLICANT_SAMPLE_DATA) 234 239 open(self.csv_file_faulty, 'wb').write(FAULTY_APPLICANT_SAMPLE_DATA) 235 240 open(self.csv_file_update, 'wb').write(APPLICANT_SAMPLE_DATA_UPDATE) 241 open(self.csv_file_update2, 'wb').write(APPLICANT_SAMPLE_DATA_UPDATE2) 236 242 237 243 def test_interface(self): … … 306 312 self.csv_file_update, APPLICANT_HEADER_FIELDS_UPDATE, 'update') 307 313 self.assertEqual(num_warns,0) 314 # The middlename import value was None. 315 # Confirm that middlename has not been deleted. 316 container = self.app['applicants']['dp2011'] 317 for key in container.keys(): 318 if container[key].lastname == 'Pieri': 319 applicant = container[key] 320 break 321 self.assertEqual(applicant.middlename, 'Peter') 322 shutil.rmtree(os.path.dirname(fin_file)) 323 # Now we import another file which clears all middlename attributes. 324 num, num_warns, fin_file, fail_file = self.processor.doImport( 325 self.csv_file_update2, APPLICANT_HEADER_FIELDS_UPDATE, 'update') 326 self.assertEqual(num_warns,0) 327 assert applicant.middlename is None 308 328 shutil.rmtree(os.path.dirname(fin_file)) 309 329
Note: See TracChangeset for help on using the changeset viewer.