Changeset 8284 for main/waeup.kofa
- Timestamp:
- 26 Apr 2012, 11:30:32 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r8232 r8284 166 166 167 167 # Update registration state 168 if 'reg_state' in row.keys(): # and row['reg_state'] not in (IGNORE_MARKER, ''): 168 reg_state = row.get('reg_state', IGNORE_MARKER) 169 if reg_state not in (IGNORE_MARKER, ''): 169 170 value = row['reg_state'] 170 171 IWorkflowState(obj).setState(value) … … 220 221 if row.has_key('reg_state') and \ 221 222 not row['reg_state'] in IMPORTABLE_STATES: 222 if row['reg_state'] != '':223 if row['reg_state'] not in (IGNORE_MARKER, ''): 223 224 errs.append(('reg_state','not allowed')) 224 else:225 errs.append(('reg_state','no value provided'))225 #else: 226 # errs.append(('reg_state','no value provided')) 226 227 return errs, inv_errs, conv_dict 227 228 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data.csv
r8210 r8284 1 1 student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,sex,reg_state 2 2 X666666,Aaren,Pieri,1,1990-01-02,100000,aa@aa.ng,1234,m,courses validated 3 ,Claus,Finau,2,1990-01-03,100001,aa@aa.ng,1234,m,courses validated3 Y777777,Claus,Finau,2,1990-01-03,100001,aa@aa.ng,1234,m,courses validated 4 4 ,Susann,Berson,3,1990-01-04,100002,aa@aa.ng,1234,f,courses validated 5 5 ,Else,Mueller,4,1990-01-05,100003,aa@aa.ng,1234,f,courses registered -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_migration.csv
r7983 r8284 4 4 C123456,Aaren,Berson,3,1990-01-04,100002,aa@aa.ng,1234,mypw1,m,admitted 5 5 D123456,John,Wolter,4,1990-01-05,100003,aa@aa.ng,1234,mypw1,m,nonsense 6 E123456,John,Kennedy,5,1990-01-06,100004,aa@aa.ng,1234,,x 6 E123456,John,Kennedy,5,1990-01-06,100004,aa@aa.ng,1234,,x, 7 F123456,Frank,Meyer,5,1990-01-06,100004,aa@aa.ng,1234,,m, -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_update.csv
r6848 r8284 1 reg_number,date_of_birth,matric_number 2 1,1980-01-02,10 3 2,1980-01-03,11 4 3,1980-01-04,12 1 reg_number,date_of_birth,matric_number,reg_state 2 1,1980-01-02,10,admitted 3 2,1980-01-03,11, 4 3,1980-01-04,12, -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r8231 r8284 222 222 dict(reg_number='1', reg_state='admitted')) 223 223 self.assertEqual(len(errs),0) 224 # Empty reg_state is allowed 224 225 errs, inv_errs, conv_dict = self.processor.checkConversion( 225 226 dict(reg_number='1', reg_state='')) 226 self.assertEqual(len(errs), 1)227 self.assertTrue(('reg_state', 'no value provided') in errs)227 self.assertEqual(len(errs),0) 228 #self.assertTrue(('reg_state', 'no value provided') in errs) 228 229 errs, inv_errs, conv_dict = self.processor.checkConversion( 229 230 dict(reg_number='1', reg_state='nonsense')) … … 243 244 assert len(self.app['students'].keys()) == 5 244 245 self.assertEqual(self.app['students']['X666666'].reg_number,'1') 246 self.assertEqual(self.app['students']['X666666'].state,'courses validated') 245 247 shutil.rmtree(os.path.dirname(fin_file)) 246 248 … … 252 254 self.csv_file_update, STUDENT_HEADER_FIELDS_UPDATE, 'update') 253 255 self.assertEqual(num_warns,0) 256 # reg_state has changed 257 self.assertEqual(self.app['students']['X666666'].state,'admitted') 258 # reg_state has not changed 259 self.assertEqual(self.app['students']['Y777777'].state,'courses validated') 254 260 shutil.rmtree(os.path.dirname(fin_file)) 255 261 … … 290 296 num, num_warns, fin_file, fail_file = self.processor.doImport( 291 297 self.csv_file_migration, STUDENT_HEADER_FIELDS_MIGRATION) 298 content = open(fail_file).read() 292 299 self.assertEqual(num_warns,2) 293 assert len(self.app['students'].keys()) == 4 294 content = open(fail_file).read() 300 assert len(self.app['students'].keys()) == 5 295 301 self.assertEqual( 296 302 content, 297 303 'reg_number,firstname,student_id,sex,email,phone,date_of_birth,reg_state,lastname,password,matric_number,--ERRORS--\r\n' 298 304 '4,John,D123456,m,aa@aa.ng,1234,1990-01-05,nonsense,Wolter,mypw1,100003,reg_state: not allowed\r\n' 299 '5,John,E123456,x,aa@aa.ng,1234,1990-01-06,,Kennedy,,100004,sex: Invalid value ; reg_state: not allowed\r\n'305 '5,John,E123456,x,aa@aa.ng,1234,1990-01-06,,Kennedy,,100004,sex: Invalid value\r\n' 300 306 ) 301 307 self.assertTrue('A123456' in self.app['students'].keys()) … … 311 317 self.assertTrue( 312 318 "State 'clearance started' set by system" in history) 319 # reg_state was empty and student is thus in state created 320 self.assertEqual(self.app['students']['F123456'].state,'created') 313 321 shutil.rmtree(os.path.dirname(fin_file)) 314 322
Note: See TracChangeset for help on using the changeset viewer.