Changeset 9293 for main/waeup.kofa/trunk
- Timestamp:
- 4 Oct 2012, 14:56:44 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_batching.py
r8616 r9293 334 334 self.assertEqual(num_warns,2) 335 335 fail_contents = open(fail_file, 'rb').read() 336 shutil.rmtree(os.path.dirname(fail_file))337 336 # CERT2 is in wrong category ... 338 337 self.assertTrue('course1: wrong application category' in fail_contents) 339 338 # ... and CERT3 does not exist. 340 339 self.assertTrue('course1: Invalid value' in fail_contents) 340 shutil.rmtree(os.path.dirname(fail_file)) 341 341 return 342 342 -
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r9284 r9293 734 734 # Check if new verdict is provided 735 735 if row['current_verdict'] in (IGNORE_MARKER, ''): 736 return 'Verdict is missing.' 736 return 'No verdict in import file.' 737 # Check if studylevel exists# 738 level_string = str(obj.current_level) 739 if obj.get(level_string) is None: 740 return 'Study level object is missing.' 737 741 # Check if student is in state REGISTERED or VALIDATED 738 742 if row.get('bypass_validation') in ('1', 'True', 'TRUE', 'yes'): … … 750 754 vals_to_set = dict((key, val) for key, val in row.items() 751 755 if key not in ('current_session','current_level')) 752 items_changed = super(StudentVerdictProcessor, self).updateEntry( 753 obj, vals_to_set, site) 754 parent = self.getParent(row, site) 755 parent.__parent__.logger.info( 756 '%s - Verdict updated: %s' 757 % (parent.student_id, items_changed)) 756 super(StudentVerdictProcessor, self).updateEntry(obj, vals_to_set, site) 757 parent = self.getParent(row, site) 758 # Set current_vedict in corresponding studylevel 759 level_string = str(obj.current_level) 760 obj[level_string].level_verdict = row['current_verdict'] 758 761 # Fire transition depending on student's state 759 762 if obj.__parent__.state == REGISTERED: -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data.csv
r9284 r9293 7 7 X999999,Herbert,Mueller,6,1990-01-02,100005,aa@aa.ng,1234,m,courses registered 8 8 X111111,Fabian,Riester,7,1990-01-02,100006,aa@aa.ng,1234,m,courses validated 9 X222222,Thomas,Kinderman,8,1990-01-02,100007,aa@aa.ng,1234,m,courses validated -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_studycourse_data.csv
r9284 r9293 8 8 6,,CERT1,2008,200 9 9 7,,CERT1,2008,200 10 8,,CERT1,2008,200 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_studylevel_data.csv
r7536 r9293 1 1 reg_number,matric_number,level_session,level_verdict,level 2 1,,2008,A,100 2 1,,2008,,100 3 1,,2008,,200 3 4 2,,2008,B,100 4 5 ,100002,2009,C,100 5 6 1,,2008,A,111 6 7 1,,2008,A,nonsense 8 4,,2008,A,200 9 5,,2008,A,200 10 6,,2008,A,200 11 7,,2008,A,200 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_verdict_data.csv
r9284 r9293 1 1 matric_number,current_session,current_level,current_verdict,bypass_validation 2 100000,2008,200, A,02 100000,2008,200,0,0 3 3 100001,2008,100,B,False 4 4 100002,2007,200,C, … … 7 7 100005,2008,200,A,1 8 8 100006,2008,200,A,True 9 100007,2008,200,A,True -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r9284 r9293 360 360 self.csv_file, STUDENT_HEADER_FIELDS) 361 361 self.assertEqual(num_warns,0) 362 self.assertEqual(len(self.app['students']), 8)362 self.assertEqual(len(self.app['students']), 9) 363 363 self.assertEqual(self.app['students']['X666666'].reg_number,'1') 364 364 self.assertEqual( … … 594 594 studycourse_file, STUDYCOURSE_HEADER_FIELDS,'update') 595 595 shutil.rmtree(os.path.dirname(fin_file)) 596 # Import study levels 597 self.csv_file = os.path.join( 598 self.workdir, 'sample_studylevel_data.csv') 599 open(self.csv_file, 'wb').write(STUDYLEVEL_SAMPLE_DATA) 600 processor = StudentStudyLevelProcessor() 601 num, num_warns, fin_file, fail_file = processor.doImport( 602 self.csv_file, STUDYLEVEL_HEADER_FIELDS,'create') 603 content = open(fail_file).read() 604 shutil.rmtree(os.path.dirname(fin_file)) 596 605 597 606 self.processor = StudentVerdictProcessor() … … 602 611 603 612 def test_import(self): 604 num, num_warns, fin_file, fail_file = self.processor.doImport(605 self.csv_file, VERDICT_HEADER_FIELDS,'update')606 self.assertEqual(num_warns,4)607 613 studycourse = self.processor.getEntry(dict(matric_number='100000'), 608 614 self.app) 615 self.assertEqual(studycourse['200'].level_verdict, None) 609 616 student = self.processor.getParent( 610 617 dict(matric_number='100000'), self.app) 611 self.assertEqual(studycourse.current_verdict, 'A') 618 num, num_warns, fin_file, fail_file = self.processor.doImport( 619 self.csv_file, VERDICT_HEADER_FIELDS,'update') 620 content = open(fail_file).read() 621 self.assertEqual(num_warns,5) 622 self.assertEqual(studycourse.current_verdict, '0') 612 623 self.assertEqual(student.state, 'returning') 613 624 self.assertEqual(studycourse.current_level, 200) 625 self.assertEqual(studycourse['200'].level_verdict, '0') 614 626 student = self.processor.getParent( 615 627 dict(matric_number='100005'), self.app) 616 self.assertEqual(studycourse.current_verdict, ' A')628 self.assertEqual(studycourse.current_verdict, '0') 617 629 self.assertEqual(student.state, 'returning') 618 630 self.assertEqual(studycourse.current_level, 200) … … 625 637 '2007,C,<IGNORE>,100002,200,Current session does not correspond.\r\n' 626 638 '2008,A,<IGNORE>,100003,200,Student in wrong state.\r\n' 627 '2008,<IGNORE>,<IGNORE>,100004,200,Verdict is missing.\r\n' 639 '2008,<IGNORE>,<IGNORE>,100004,200,No verdict in import file.\r\n' 640 '2008,A,True,100007,200,Study level object is missing.\r\n' 628 641 ) 629 642 shutil.rmtree(os.path.dirname(fin_file)) … … 685 698 self.assertEqual(studylevel.__parent__.certificate.code, u'CERT1') 686 699 self.assertEqual(studylevel.level_session, 2008) 687 self.assertEqual(studylevel.level_verdict, 'A')700 self.assertEqual(studylevel.level_verdict, None) 688 701 self.assertEqual(studylevel.level, 100) 689 702 shutil.rmtree(os.path.dirname(fin_file)) -
main/waeup.kofa/trunk/src/waeup/kofa/university/tests/test_batching.py
r9283 r9293 106 106 self.logfile = os.path.join( 107 107 self.app['datacenter'].storage, 'logs', 'main.log') 108 return109 108 return 110 109
Note: See TracChangeset for help on using the changeset viewer.