Changeset 9797 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 13 Dec 2012, 15:39:31 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r9788 r9797 183 183 exporter = StudentsExporter() 184 184 185 exporter.export_filtered(self.app, None, None, filepath=self.outfile) 185 exporter.export_filtered( 186 self.app, self.outfile, 187 current_session=None, current_level=None) 186 188 result1 = open(self.outfile, 'rb').read() 187 exporter.export_filtered(self.app, 2012, None, filepath=self.outfile) 189 exporter.export_filtered( 190 self.app, self.outfile, 191 current_session=2012, current_level=None) 188 192 result2 = open(self.outfile, 'rb').read() 189 exporter.export_filtered(self.app, None, 200, filepath=self.outfile) 193 exporter.export_filtered( 194 self.app, self.outfile, 195 current_session=None, current_level=200) 190 196 result3 = open(self.outfile, 'rb').read() 191 exporter.export_filtered(self.app, 2011, None, filepath=self.outfile) 197 exporter.export_filtered( 198 self.app, self.outfile, 199 current_session=2011, current_level=None) 192 200 result4 = open(self.outfile, 'rb').read() 193 exporter.export_filtered(self.app, None, 100, filepath=self.outfile) 201 exporter.export_filtered( 202 self.app, self.outfile, 203 current_session=None, current_level=100) 194 204 result5 = open(self.outfile, 'rb').read() 195 205 self.assertTrue(self.std_csv_entry in result1) … … 207 217 exporter = StudentsExporter() 208 218 209 exporter.export_filtered(self.app, 2012, 200, depcode='NA', 210 filepath=self.outfile) 219 exporter.export_filtered( 220 self.app, self.outfile, 221 current_session=2012, current_level=200, depcode='NA') 211 222 result1 = open(self.outfile, 'rb').read() 212 exporter.export_filtered(self.app, 2012, 200, depcode='NODEPT', 213 filepath=self.outfile) 223 exporter.export_filtered( 224 self.app, self.outfile, 225 current_session=2012, current_level=200, depcode='NODEPT') 214 226 result2 = open(self.outfile, 'rb').read() 215 227 self.assertTrue(self.std_csv_entry in result1) … … 225 237 226 238 exporter.export_filtered( 227 self.app, 2012, 200, faccode='NA', filepath=self.outfile) 239 self.app, self.outfile, 240 current_session=2012, current_level=200, faccode='NA') 228 241 result1 = open(self.outfile, 'rb').read() 229 exporter.export_filtered(self.app, 2012, 200, faccode='NOFAC', 230 filepath=self.outfile) 242 exporter.export_filtered( 243 self.app, self.outfile, 244 current_session=2012, current_level=200, faccode='NOFAC') 231 245 result2 = open(self.outfile, 'rb').read() 232 246 self.assertTrue(self.std_csv_entry in result1) … … 234 248 return 235 249 236 237 250 class StudentStudyCourseExporterTest(StudentImportExportSetup): 238 251 … … 247 260 # make sure we fullfill interface contracts 248 261 obj = StudentStudyCourseExporter() 249 verifyObject(ICSV Exporter, obj)250 verifyClass(ICSV Exporter, StudentStudyCourseExporter)262 verifyObject(ICSVStudentExporter, obj) 263 verifyClass(ICSVStudentExporter, StudentStudyCourseExporter) 251 264 return 252 265 … … 320 333 return 321 334 335 def test_export_filtered(self): 336 # we can export studycourses of a filtered set of students 337 self.setup_student(self.student) 338 self.app['students'].addStudent(self.student) 339 notify(grok.ObjectModifiedEvent(self.student)) 340 341 exporter = StudentStudyCourseExporter() 342 exporter.export_filtered( 343 self.student, self.outfile, current_session=2012) 344 result = open(self.outfile, 'rb').read() 345 self.assertEqual( 346 result, 347 'certificate,current_level,current_session,current_verdict,' 348 'entry_mode,entry_session,previous_verdict,student_id\r\n' 349 350 'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n' 351 ) 352 return 353 354 355 322 356 class StudentStudyLevelExporterTest(StudentImportExportSetup): 323 357 … … 332 366 # make sure we fullfill interface contracts 333 367 obj = StudentStudyLevelExporter() 334 verifyObject(ICSV Exporter, obj)335 verifyClass(ICSV Exporter, StudentStudyLevelExporter)368 verifyObject(ICSVStudentExporter, obj) 369 verifyClass(ICSVStudentExporter, StudentStudyLevelExporter) 336 370 return 337 371 … … 406 440 return 407 441 442 def test_export_filtered(self): 443 # we can export studylevels of a filtered set of students 444 self.setup_student(self.student) 445 self.app['students'].addStudent(self.student) 446 notify(grok.ObjectModifiedEvent(self.student)) 447 448 exporter = StudentStudyLevelExporter() 449 exporter.export_filtered( 450 self.student, self.outfile, current_level=200) 451 result = open(self.outfile, 'rb').read() 452 self.assertEqual( 453 result, 454 'gpa,level,level_session,level_verdict,total_credits,' 455 'validated_by,validation_date,' 456 'student_id,number_of_tickets,certcode\r\n' 457 '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n' 458 ) 459 return 460 408 461 class CourseTicketExporterTest(StudentImportExportSetup): 409 462 … … 418 471 # make sure we fullfill interface contracts 419 472 obj = CourseTicketExporter() 420 verifyObject(ICSV Exporter, obj)421 verifyClass(ICSV Exporter, CourseTicketExporter)473 verifyObject(ICSVStudentExporter, obj) 474 verifyClass(ICSVStudentExporter, CourseTicketExporter) 422 475 return 423 476 … … 489 542 return 490 543 544 def test_export_filtered(self): 545 # we can export studylevels of a filtered set of students 546 self.setup_student(self.student) 547 self.app['students'].addStudent(self.student) 548 notify(grok.ObjectModifiedEvent(self.student)) 549 550 exporter = CourseTicketExporter() 551 exporter.export_filtered( 552 self.student, self.outfile, current_level=200) 553 result = open(self.outfile, 'rb').read() 554 self.assertEqual( 555 result, 556 'automatic,carry_over,code,credits,dcode,fcode,level,mandatory,' 557 'passmark,score,semester,title,student_id,certcode\r\n' 558 '1,1,CRS1,100,DEP1,FAC1,100,0,100,,2,Course 1,A111111,CERT1\r\n' 559 ) 560 return 561 491 562 class PaymentsExporterTest(StudentImportExportSetup): 492 563 … … 501 572 # make sure we fullfill interface contracts 502 573 obj = PaymentsExporter() 503 verifyObject(ICSV Exporter, obj)504 verifyClass(ICSV Exporter, PaymentsExporter)574 verifyObject(ICSVStudentExporter, obj) 575 verifyClass(ICSVStudentExporter, PaymentsExporter) 505 576 return 506 577 … … 586 657 return 587 658 659 def test_export_filtered(self): 660 # we can export payments of a filtered set of students 661 self.setup_student(self.student) 662 self.app['students'].addStudent(self.student) 663 notify(grok.ObjectModifiedEvent(self.student)) 664 665 exporter = PaymentsExporter() 666 exporter.export_filtered( 667 self.student, self.outfile, current_level=200) 668 result = open(self.outfile, 'rb').read() 669 self.assertEqual( 670 result, 671 'ac,amount_auth,creation_date,p_category,p_current,p_id,' 672 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 673 'r_code,r_desc,student_id,student_state,current_session\r\n' 674 675 '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,' 676 'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,' 677 'r-code,,A111111,created,2012\r\n' 678 ) 679 return 680 588 681 class BedTicketsExporterTest(StudentImportExportSetup): 589 682 … … 598 691 # make sure we fullfill interface contracts 599 692 obj = BedTicketsExporter() 600 verifyObject(ICSV Exporter, obj)601 verifyClass(ICSV Exporter, BedTicketsExporter)693 verifyObject(ICSVStudentExporter, obj) 694 verifyClass(ICSVStudentExporter, BedTicketsExporter) 602 695 return 603 696 … … 673 766 return 674 767 768 def test_export_filtered(self): 769 # we can export payments of a filtered set of students 770 self.setup_student(self.student) 771 self.app['students'].addStudent(self.student) 772 notify(grok.ObjectModifiedEvent(self.student)) 773 774 exporter = BedTicketsExporter() 775 exporter.export_filtered( 776 self.student, self.outfile, current_level=200) 777 result = open(self.outfile, 'rb').read() 778 self.assertMatches( 779 result, 780 'bed,bed_coordinates,bed_type,booking_code,booking_date,' 781 'booking_session,student_id,actual_bed_type\r\n' 782 'hall-1_A_101_A,,any bed type,,<YYYY-MM-DD hh:mm:ss>.<6-DIGITS>,' 783 '2004,A111111,regular_male_fr\r\n') 784 return 785 786 675 787 class StudentPaymentsOverviewExporterTest(StudentImportExportSetup): 676 788 … … 685 797 # make sure we fullfill interface contracts 686 798 obj = StudentPaymentsOverviewExporter() 687 verifyObject(ICSV Exporter, obj)688 verifyClass(ICSV Exporter, StudentPaymentsOverviewExporter)799 verifyObject(ICSVStudentExporter, obj) 800 verifyClass(ICSVStudentExporter, StudentPaymentsOverviewExporter) 689 801 return 690 802 … … 744 856 def test_ifaces(self): 745 857 obj = StudentStudyLevelsOverviewExporter() 746 verifyObject(ICSV Exporter, obj)747 verifyClass(ICSV Exporter, StudentStudyLevelsOverviewExporter)858 verifyObject(ICSVStudentExporter, obj) 859 verifyClass(ICSVStudentExporter, StudentStudyLevelsOverviewExporter) 748 860 return 749 861
Note: See TracChangeset for help on using the changeset viewer.