Changeset 16831 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 24 Feb 2022, 10:23:10 (3 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r16828 r16831 40 40 StudentStudyLevelProcessor, CourseTicketProcessor, 41 41 StudentOnlinePaymentProcessor, StudentVerdictProcessor, 42 FirstStudentStudyCourseProcessor, 43 FirstStudentStudyLevelProcessor, 44 FirstCourseTicketProcessor) 42 ) 45 43 from waeup.kofa.students.payments import StudentOnlinePayment 46 44 from waeup.kofa.students.student import Student … … 95 93 '\n')[0].split(',') 96 94 95 FIRST_STUDYCOURSE_SAMPLE_DATA = open( 96 os.path.join(os.path.dirname(__file__), 'sample_first_studycourse_data.csv'), 97 'rb').read() 98 99 FIRST_STUDYCOURSE_HEADER_FIELDS = FIRST_STUDYCOURSE_SAMPLE_DATA.split( 100 '\n')[0].split(',') 101 97 102 TRANSFER_SAMPLE_DATA = open( 98 103 os.path.join(os.path.dirname(__file__), 'sample_transfer_data.csv'), … … 140 145 '\n')[0].split(',') 141 146 147 FIRST_STUDYLEVEL_SAMPLE_DATA = open( 148 os.path.join(os.path.dirname(__file__), 'sample_first_studylevel_data.csv'), 149 'rb').read() 150 151 FIRST_STUDYLEVEL_HEADER_FIELDS = FIRST_STUDYLEVEL_SAMPLE_DATA.split( 152 '\n')[0].split(',') 153 142 154 COURSETICKET_SAMPLE_DATA = open( 143 155 os.path.join(os.path.dirname(__file__), 'sample_courseticket_data.csv'), … … 145 157 146 158 COURSETICKET_HEADER_FIELDS = COURSETICKET_SAMPLE_DATA.split( 159 '\n')[0].split(',') 160 161 FIRST_COURSETICKET_SAMPLE_DATA = open( 162 os.path.join(os.path.dirname(__file__), 'sample_first_courseticket_data.csv'), 163 'rb').read() 164 165 FIRST_COURSETICKET_HEADER_FIELDS = FIRST_COURSETICKET_SAMPLE_DATA.split( 147 166 '\n')[0].split(',') 148 167 … … 1141 1160 1142 1161 def test_import_firstcourse_with_content(self): 1143 processor = FirstStudentStudyCourseProcessor()1162 processor = StudentStudyCourseProcessor() 1144 1163 csv_file = os.path.join( 1145 self.workdir, 'sample_studycourse_data.csv') 1164 self.workdir, 'sample_first_studycourse_data.csv') 1165 open(csv_file, 'wb').write(FIRST_STUDYCOURSE_SAMPLE_DATA) 1146 1166 num, num_warns, fin_file, fail_file = processor.doImport( 1147 csv_file, STUDYCOURSE_HEADER_FIELDS,'create')1167 csv_file, FIRST_STUDYCOURSE_HEADER_FIELDS,'create') 1148 1168 self.assertEqual(num_warns,1) 1149 1169 content = open(fail_file).read() 1150 1170 self.assertTrue('current_level: not in range' in content) 1151 studycourse = processor.getEntry(dict(reg_number='1'), self.app) 1171 studycourse = processor.getEntry( 1172 dict(reg_number='1', previous='1'), self.app) 1152 1173 self.assertEqual(studycourse.certificate.code, u'CERT1') 1153 1174 self.assertEqual(studycourse.__name__, u'studycourse_1') … … 1156 1177 self.assertEqual([i for i in results[0].keys()], 1157 1178 [u'accommodation', u'payments', u'studycourse', u'studycourse_1']) 1158 processor = FirstStudentStudyLevelProcessor() 1179 1180 processor = StudentStudyLevelProcessor() 1159 1181 csv_file = os.path.join( 1160 self.workdir, 'sample_studylevel_data.csv') 1182 self.workdir, 'sample_first_studylevel_data.csv') 1183 open(csv_file, 'wb').write(FIRST_STUDYLEVEL_SAMPLE_DATA) 1161 1184 num, num_warns, fin_file, fail_file = processor.doImport( 1162 csv_file, STUDYLEVEL_HEADER_FIELDS,'create')1185 csv_file, FIRST_STUDYLEVEL_HEADER_FIELDS,'create') 1163 1186 self.assertEqual(num_warns,3) 1164 1187 assert processor.entryExists( … … 1172 1195 self.assertEqual([i for i in results[0]['studycourse_1'].keys()], 1173 1196 [u'100', u'200']) 1174 processor = FirstCourseTicketProcessor() 1197 1198 processor = CourseTicketProcessor() 1175 1199 csv_file = os.path.join( 1176 self.workdir, 'sample_courseticket_data.csv') 1200 self.workdir, 'sample_first_courseticket_data.csv') 1201 open(csv_file, 'wb').write(FIRST_COURSETICKET_SAMPLE_DATA) 1177 1202 num, num_warns, fin_file, fail_file = processor.doImport( 1178 csv_file, COURSETICKET_HEADER_FIELDS,'create')1203 csv_file, FIRST_COURSETICKET_HEADER_FIELDS,'create') 1179 1204 assert processor.entryExists( 1180 dict(reg_number='1', level='100', code='COURSE1'), self.app) is True 1205 dict(reg_number='1', level='100', 1206 code='COURSE1', previous='1'), self.app) is True 1181 1207 self.assertEqual([i for i in results[0]['studycourse_1']['100'].keys()], 1182 1208 [u'COURSE1']) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r16827 r16831 416 416 result, 417 417 'certificate,current_level,current_session,current_verdict,' 418 'entry_mode,entry_session,previous_verdict,student_id \r\n'419 420 ',,,0,,,0, \r\n'418 'entry_mode,entry_session,previous_verdict,student_id,previous\r\n' 419 420 ',,,0,,,0,,0\r\n' 421 421 ) 422 422 return … … 433 433 result, 434 434 'certificate,current_level,current_session,current_verdict,' 435 'entry_mode,entry_session,previous_verdict,student_id \r\n'436 437 'CERT1,200,2012,0,ug_ft,2010,0,A111111 \r\n'435 'entry_mode,entry_session,previous_verdict,student_id,previous\r\n' 436 437 'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n' 438 438 ) 439 439 return … … 449 449 result, 450 450 'certificate,current_level,current_session,current_verdict,' 451 'entry_mode,entry_session,previous_verdict,student_id \r\n'452 453 'CERT1,200,2012,0,ug_ft,2010,0,A111111 \r\n'451 'entry_mode,entry_session,previous_verdict,student_id,previous\r\n' 452 453 'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n' 454 454 ) 455 455 return … … 464 464 result, 465 465 'certificate,current_level,current_session,current_verdict,' 466 'entry_mode,entry_session,previous_verdict,student_id \r\n'467 468 'CERT1,200,2012,0,ug_ft,2010,0,A111111 \r\n'466 'entry_mode,entry_session,previous_verdict,student_id,previous\r\n' 467 468 'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n' 469 469 ) 470 470 return … … 483 483 result, 484 484 'certificate,current_level,current_session,current_verdict,' 485 'entry_mode,entry_session,previous_verdict,student_id \r\n'486 487 'CERT1,200,2012,0,ug_ft,2010,0,A111111 \r\n'485 'entry_mode,entry_session,previous_verdict,student_id,previous\r\n' 486 487 'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n' 488 488 ) 489 489 return … … 501 501 result, 502 502 'certificate,current_level,current_session,current_verdict,' 503 'entry_mode,entry_session,previous_verdict,student_id \r\n'504 505 'CERT1,200,2012,0,ug_ft,2010,0,A111111 \r\n'503 'entry_mode,entry_session,previous_verdict,student_id,previous\r\n' 504 505 'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n' 506 506 ) 507 507 return … … 519 519 result, 520 520 'certificate,current_level,current_session,current_verdict,' 521 'entry_mode,entry_session,previous_verdict,student_id \r\n'522 523 'CERT1,200,2012,0,ug_ft,2010,0,A111111 \r\n'521 'entry_mode,entry_session,previous_verdict,student_id,previous\r\n' 522 523 'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n' 524 524 ) 525 525 return … … 549 549 result, 550 550 'certificate,current_level,current_session,current_verdict,' 551 'entry_mode,entry_session,previous_verdict,student_id \r\n'551 'entry_mode,entry_session,previous_verdict,student_id,previous\r\n' 552 552 ) 553 553 error = self.student.transfer(self.certificate2, current_session=2013) … … 558 558 result, 559 559 'certificate,current_level,current_session,current_verdict,' 560 'entry_mode,entry_session,previous_verdict,student_id \r\n'561 'CERT1,200,2012,0,ug_ft,2010,0,A111111 \r\n')560 'entry_mode,entry_session,previous_verdict,student_id,previous\r\n' 561 'CERT1,200,2012,0,ug_ft,2010,0,A111111,1\r\n') 562 562 error = self.student.transfer(self.certificate, 563 563 current_session=2014, … … 570 570 result, 571 571 'certificate,current_level,current_session,current_verdict,' 572 'entry_mode,entry_session,previous_verdict,student_id \r\n'573 'CERT2,,2013,,transfer,2010,,A111111 \r\n')572 'entry_mode,entry_session,previous_verdict,student_id,previous\r\n' 573 'CERT2,,2013,,transfer,2010,,A111111,2\r\n') 574 574 exporter = StudentStudyCourseExporter() 575 575 exporter.export_all(self.app, self.outfile) … … 578 578 result, 579 579 'certificate,current_level,current_session,current_verdict,' 580 'entry_mode,entry_session,previous_verdict,student_id \r\n'581 'CERT1,300,2014,,transfer,2010,,A111111 \r\n')580 'entry_mode,entry_session,previous_verdict,student_id,previous\r\n' 581 'CERT1,300,2014,,transfer,2010,,A111111,0\r\n') 582 582 return 583 583 … … 591 591 'gpa,level,level_session,level_verdict,total_credits,' 592 592 'transcript_remark,validated_by,validation_date,student_id,' 593 'number_of_tickets,certcode \r\n'593 'number_of_tickets,certcode,previous\r\n' 594 594 ) 595 595 error = self.student.transfer(self.certificate2, current_session=2013) … … 601 601 'gpa,level,level_session,level_verdict,total_credits,' 602 602 'transcript_remark,validated_by,validation_date,student_id,' 603 'number_of_tickets,certcode \r\n'604 '0.00,100,2012,A,100,,,,A111111,1,CERT1 \r\n' )603 'number_of_tickets,certcode,previous\r\n' 604 '0.00,100,2012,A,100,,,,A111111,1,CERT1,1\r\n' ) 605 605 study_level = StudentStudyLevel() 606 606 study_level.level_session = 2015 … … 620 620 'gpa,level,level_session,level_verdict,total_credits,' 621 621 'transcript_remark,validated_by,validation_date,student_id,' 622 'number_of_tickets,certcode \r\n'623 '0.00,400,2015,C,0,,,,A111111,0,CERT2 \r\n')622 'number_of_tickets,certcode,previous\r\n' 623 '0.00,400,2015,C,0,,,,A111111,0,CERT2,2\r\n') 624 624 exporter = StudentStudyLevelExporter() 625 625 exporter.export_all(self.app, self.outfile) … … 629 629 'gpa,level,level_session,level_verdict,total_credits,' 630 630 'transcript_remark,validated_by,validation_date,student_id,' 631 'number_of_tickets,certcode \r\n')631 'number_of_tickets,certcode,previous\r\n') 632 632 return 633 633 … … 642 642 'fcode,level,level_session,mandatory,outstanding,passmark,' 643 643 'score,semester,ticket_session,title,student_id,certcode,' 644 'display_fullname \r\n'644 'display_fullname,previous\r\n' 645 645 ) 646 646 error = self.student.transfer(self.certificate2, current_session=2013) … … 653 653 'fcode,level,level_session,mandatory,outstanding,passmark,' 654 654 'score,semester,ticket_session,title,student_id,certcode,' 655 'display_fullname \r\n'655 'display_fullname,previous\r\n' 656 656 '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,' 657 'A111111,CERT1,Anna M. Tester \r\n')657 'A111111,CERT1,Anna M. Tester,1\r\n') 658 658 study_level = StudentStudyLevel() 659 659 study_level.level_session = 2015 … … 685 685 'fcode,level,level_session,mandatory,outstanding,passmark,' 686 686 'score,semester,ticket_session,title,student_id,certcode,' 687 'display_fullname \r\n1,1,CRS9,,150,DEP9,FAC9,400,2015,0,0,'688 '100,,2,,Course 9,A111111,CERT2,Anna M. Tester \r\n')687 'display_fullname,previous\r\n1,1,CRS9,,150,DEP9,FAC9,400,2015,0,0,' 688 '100,,2,,Course 9,A111111,CERT2,Anna M. Tester,2\r\n') 689 689 exporter = CourseTicketExporter() 690 690 exporter.export_all(self.app, self.outfile) … … 695 695 'fcode,level,level_session,mandatory,outstanding,passmark,' 696 696 'score,semester,ticket_session,title,student_id,certcode,' 697 'display_fullname \r\n'697 'display_fullname,previous\r\n' 698 698 ) 699 699 return … … 731 731 'gpa,level,level_session,level_verdict,total_credits,' 732 732 'transcript_remark,validated_by,validation_date,' 733 'student_id,number_of_tickets,certcode \r\n'734 '0.00,,,0,0,,,,,0, \r\n'733 'student_id,number_of_tickets,certcode,previous\r\n' 734 '0.00,,,0,0,,,,,0,,0\r\n' 735 735 ) 736 736 return … … 749 749 'gpa,level,level_session,level_verdict,total_credits,' 750 750 'transcript_remark,validated_by,validation_date,' 751 'student_id,number_of_tickets,certcode \r\n'752 '0.00,100,2012,A,100,,,,A111111,1,CERT1 \r\n'751 'student_id,number_of_tickets,certcode,previous\r\n' 752 '0.00,100,2012,A,100,,,,A111111,1,CERT1,0\r\n' 753 753 ) 754 754 return … … 765 765 'gpa,level,level_session,level_verdict,total_credits,' 766 766 'transcript_remark,validated_by,validation_date,' 767 'student_id,number_of_tickets,certcode \r\n'768 '0.00,100,2012,A,100,,,,A111111,1,CERT1 \r\n'767 'student_id,number_of_tickets,certcode,previous\r\n' 768 '0.00,100,2012,A,100,,,,A111111,1,CERT1,0\r\n' 769 769 ) 770 770 return … … 780 780 'gpa,level,level_session,level_verdict,total_credits,' 781 781 'transcript_remark,validated_by,validation_date,' 782 'student_id,number_of_tickets,certcode \r\n'783 '0.00,100,2012,A,100,,,,A111111,1,CERT1 \r\n'782 'student_id,number_of_tickets,certcode,previous\r\n' 783 '0.00,100,2012,A,100,,,,A111111,1,CERT1,0\r\n' 784 784 ) 785 785 return … … 799 799 'gpa,level,level_session,level_verdict,total_credits,' 800 800 'transcript_remark,validated_by,validation_date,' 801 'student_id,number_of_tickets,certcode \r\n'802 '0.00,100,2012,A,100,,,,A111111,1,CERT1 \r\n'801 'student_id,number_of_tickets,certcode,previous\r\n' 802 '0.00,100,2012,A,100,,,,A111111,1,CERT1,0\r\n' 803 803 ) 804 804 return … … 818 818 'gpa,level,level_session,level_verdict,total_credits,' 819 819 'transcript_remark,validated_by,validation_date,' 820 'student_id,number_of_tickets,certcode \r\n'821 '0.00,100,2012,A,100,,,,A111111,1,CERT1 \r\n'820 'student_id,number_of_tickets,certcode,previous\r\n' 821 '0.00,100,2012,A,100,,,,A111111,1,CERT1,0\r\n' 822 822 ) 823 823 return … … 855 855 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 856 856 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 857 'display_fullname \r\n'858 '0,0,,,,,,,,0,0,,,,,,,, \r\n'857 'display_fullname,previous\r\n' 858 '0,0,,,,,,,,0,0,,,,,,,,,0\r\n' 859 859 ) 860 860 return … … 874 874 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 875 875 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 876 'display_fullname \r\n'876 'display_fullname,previous\r\n' 877 877 '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,' 878 'Anna M. Tester \r\n'878 'Anna M. Tester,0\r\n' 879 879 ) 880 880 return … … 891 891 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 892 892 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 893 'display_fullname \r\n'893 'display_fullname,previous\r\n' 894 894 '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,' 895 'Anna M. Tester \r\n'895 'Anna M. Tester,0\r\n' 896 896 ) 897 897 return … … 907 907 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 908 908 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 909 'display_fullname \r\n'909 'display_fullname,previous\r\n' 910 910 '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,' 911 'Anna M. Tester \r\n'911 'Anna M. Tester,0\r\n' 912 912 ) 913 913 return … … 926 926 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 927 927 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 928 'display_fullname \r\n'928 'display_fullname,previous\r\n' 929 929 '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,' 930 'Anna M. Tester \r\n'930 'Anna M. Tester,0\r\n' 931 931 ) 932 932 # We can set the course tickets level, semester and level_session … … 940 940 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 941 941 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 942 'display_fullname \r\n'942 'display_fullname,previous\r\n' 943 943 '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,' 944 'Anna M. Tester \r\n'944 'Anna M. Tester,0\r\n' 945 945 ) 946 946 # 'all' does select all … … 953 953 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 954 954 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 955 'display_fullname \r\n'955 'display_fullname,previous\r\n' 956 956 '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,' 957 'Anna M. Tester \r\n'957 'Anna M. Tester,0\r\n' 958 958 ) 959 959 # Level 200 tickets do not exist. … … 965 965 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 966 966 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 967 'display_fullname \r\n'967 'display_fullname,previous\r\n' 968 968 ) 969 969 # Session 2013 tickets do not exist. … … 976 976 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 977 977 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 978 'display_fullname \r\n'978 'display_fullname,previous\r\n' 979 979 ) 980 980 # 1st semester tickets do not exist. … … 987 987 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 988 988 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 989 'display_fullname \r\n'989 'display_fullname,previous\r\n' 990 990 ) 991 991 # If the coursetickets catalog is used to filter students … … 999 999 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 1000 1000 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 1001 'display_fullname \r\n'1001 'display_fullname,previous\r\n' 1002 1002 '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,' 1003 'Anna M. Tester \r\n'1003 'Anna M. Tester,0\r\n' 1004 1004 ) 1005 1005 exporter.export_filtered( … … 1010 1010 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 1011 1011 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 1012 'display_fullname \r\n'1012 'display_fullname,previous\r\n' 1013 1013 ) 1014 1014 # Also tickets in probating levels are exported. Therefore … … 1023 1023 'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,' 1024 1024 'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,' 1025 'display_fullname \r\n'1025 'display_fullname,previous\r\n' 1026 1026 '1,1,CRS1,,100,DEP1,FAC1,110,2012,0,0,100,,2,,Course 1,A111111,CERT1,' 1027 'Anna M. Tester \r\n'1027 'Anna M. Tester,0\r\n' 1028 1028 ) 1029 1029 return
Note: See TracChangeset for help on using the changeset viewer.