- Timestamp:
- 2 Oct 2012, 14:01:38 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r9151 r9272 95 95 96 96 STUDENT_SAMPLE_DATA_MIGRATION = open( 97 os.path.join(os.path.dirname(__file__), 'sample_student_data_migration.csv'), 97 os.path.join(os.path.dirname(__file__), 98 'sample_student_data_migration.csv'), 98 99 'rb').read() 99 100 … … 102 103 103 104 STUDENT_SAMPLE_DATA_DUPLICATES = open( 104 os.path.join(os.path.dirname(__file__), 'sample_student_data_duplicates.csv'), 105 os.path.join(os.path.dirname(__file__), 106 'sample_student_data_duplicates.csv'), 105 107 'rb').read() 106 108 … … 256 258 257 259 self.processor = StudentProcessor() 258 self.workdir = tempfile.mkdtemp()259 260 self.csv_file = os.path.join(self.workdir, 'sample_student_data.csv') 260 261 self.csv_file_update = os.path.join( … … 377 378 self.assertEqual(self.app['students']['X666666'].state,'admitted') 378 379 # state has not changed 379 self.assertEqual(self.app['students']['Y777777'].state,'courses validated') 380 self.assertEqual(self.app['students']['Y777777'].state, 381 'courses validated') 380 382 shutil.rmtree(os.path.dirname(fin_file)) 381 383 … … 411 413 self.csv_file_update3, STUDENT_HEADER_FIELDS_UPDATE3, 'update') 412 414 content = open(fail_file).read() 415 shutil.rmtree(os.path.dirname(fin_file)) 413 416 self.assertEqual( 414 417 content, … … 546 549 def test_checkUpdateRequirements(self): 547 550 # Make sure that pg students can't be updated with wrong transition. 548 err = self.processor.checkUpdateRequirements(self.student['studycourse'], 551 err = self.processor.checkUpdateRequirements( 552 self.student['studycourse'], 549 553 dict(reg_number='1', current_level='100'), self.app) 550 554 self.assertTrue(err is None) 551 555 # Since row has passed the converter, current_level is an integer. 552 err = self.processor.checkUpdateRequirements(self.student['studycourse'], 556 err = self.processor.checkUpdateRequirements( 557 self.student['studycourse'], 553 558 dict(reg_number='1', current_level=999), self.app) 554 559 self.assertTrue(err is None) 555 560 IWorkflowState(self.student).setState('returning') 556 err = self.processor.checkUpdateRequirements(self.student['studycourse'], 561 err = self.processor.checkUpdateRequirements( 562 self.student['studycourse'], 557 563 dict(reg_number='1', current_level=999), self.app) 558 564 self.assertEqual(err, 'Not a pg student.') … … 600 606 self.csv_file, VERDICT_HEADER_FIELDS,'update') 601 607 self.assertEqual(num_warns,3) 602 studycourse = self.processor.getEntry(dict(matric_number='100000'), self.app) 603 student = self.processor.getParent(dict(matric_number='100000'), self.app) 608 studycourse = self.processor.getEntry(dict(matric_number='100000'), 609 self.app) 610 student = self.processor.getParent( 611 dict(matric_number='100000'), self.app) 604 612 self.assertEqual(studycourse.current_verdict, 'A') 605 613 self.assertEqual(student.state, 'returning') … … 688 696 num, num_warns, fin_file, fail_file = self.processor.doImport( 689 697 self.csv_file, STUDYLEVEL_HEADER_FIELDS,'create') 698 shutil.rmtree(os.path.dirname(fin_file)) 690 699 num, num_warns, fin_file, fail_file = self.processor.doImport( 691 700 self.csv_file, STUDYLEVEL_HEADER_FIELDS,'update') … … 713 722 self.app['faculties']['fac1']['dep1'].courses.addCourse( 714 723 self.course) 715 self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCertCourse( 724 self.app['faculties']['fac1']['dep1'].certificates[ 725 'CERT1'].addCertCourse( 716 726 self.course, level=100) 717 727 … … 761 771 self.assertEqual(num_warns,2) 762 772 assert self.processor.entryExists( 763 dict(reg_number='1', level='100', code='COURSE1'), self.app) is True 773 dict(reg_number='1', level='100', code='COURSE1'), 774 self.app) is True 764 775 courseticket = self.processor.getEntry( 765 776 dict(reg_number='1', level='100', code='COURSE1'), self.app) 766 self.assertEqual(courseticket.__parent__.__parent__.certificate.code, u'CERT1') 777 self.assertEqual(courseticket.__parent__.__parent__.certificate.code, 778 u'CERT1') 767 779 self.assertEqual(courseticket.score, 1) 768 780 self.assertEqual(courseticket.mandatory, True) … … 789 801 num, num_warns, fin_file, fail_file = self.processor.doImport( 790 802 self.csv_file, COURSETICKET_HEADER_FIELDS,'create') 803 shutil.rmtree(os.path.dirname(fin_file)) 791 804 num, num_warns, fin_file, fail_file = self.processor.doImport( 792 805 self.csv_file, COURSETICKET_HEADER_FIELDS,'update') … … 800 813 num, num_warns, fin_file, fail_file = self.processor.doImport( 801 814 self.csv_file, COURSETICKET_HEADER_FIELDS,'create') 815 shutil.rmtree(os.path.dirname(fin_file)) 802 816 assert self.processor.entryExists( 803 817 dict(reg_number='1', level='100', code='COURSE1'), self.app) is True … … 946 960 num, num_warns, fin_file, fail_file = self.processor.doImport( 947 961 self.csv_file, PAYMENT_HEADER_FIELDS,'create') 962 shutil.rmtree(os.path.dirname(fin_file)) 948 963 num, num_warns, fin_file, fail_file = self.processor.doImport( 949 964 self.csv_file, PAYMENT_HEADER_FIELDS,'update') … … 954 969 num, num_warns, fin_file, fail_file = self.processor.doImport( 955 970 self.csv_file, PAYMENT_HEADER_FIELDS,'create') 971 shutil.rmtree(os.path.dirname(fin_file)) 956 972 num, num_warns, fin_file, fail_file = self.processor.doImport( 957 973 self.csv_file, PAYMENT_HEADER_FIELDS,'remove')
Note: See TracChangeset for help on using the changeset viewer.