Changeset 8888
- Timestamp:
- 3 Jul 2012, 11:20:18 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r8886 r8888 370 370 raw_header = reader.next() 371 371 for num, field in enumerate(headerfields): 372 if field not in ['student_id', 'reg_number', 'matric_number', 'p_id' 372 if field not in ['student_id', 'reg_number', 'matric_number', 373 'p_id', 'code', 'level' 373 374 ] and mode == 'remove': 374 375 continue … … 527 528 items_changed = super(CourseTicketProcessor, self).updateEntry( 528 529 obj, row, site) 530 parent = self.getParent(row, site) 529 531 student = self.getParent(row, site).__parent__.__parent__ 530 532 student.__parent__.logger.info( 531 '%s - Course ticket updated: %s'532 % (student.student_id, items_changed))533 '%s - Course ticket in %s updated: %s' 534 % (student.student_id, parent.level, items_changed)) 533 535 return 534 536 … … 544 546 obj.semester = entries[0].semester 545 547 parent[row['code']] = obj 548 return 549 550 def delEntry(self, row, site): 551 ticket = self.getEntry(row, site) 552 parent = self.getParent(row, site) 553 if ticket is not None: 554 student = self._getStudent(row, site) 555 student.__parent__.logger.info('%s - Course ticket in %s removed: %s' 556 % (student.student_id, parent.level, ticket.code)) 557 del parent[ticket.code] 546 558 return 547 559 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r8886 r8888 762 762 # Logging message from updateEntry, 763 763 self.assertTrue( 764 'INFO - system - K1000000 - Course ticket updated: code=COURSE1, '764 'INFO - system - K1000000 - Course ticket in 100 updated: code=COURSE1, ' 765 765 'mandatory=False, score=3' 766 766 in logcontent) … … 776 776 self.assertEqual(num_warns,2) 777 777 shutil.rmtree(os.path.dirname(fin_file)) 778 779 def test_import_remove(self): 780 # We perform the same import twice, 781 # the second time in remove mode. The number 782 # of warnings must be the same. 783 num, num_warns, fin_file, fail_file = self.processor.doImport( 784 self.csv_file, COURSETICKET_HEADER_FIELDS,'create') 785 assert self.processor.entryExists( 786 dict(reg_number='1', level='100', code='COURSE1'), self.app) is True 787 num, num_warns, fin_file, fail_file = self.processor.doImport( 788 self.csv_file, COURSETICKET_HEADER_FIELDS,'remove') 789 self.assertEqual(num_warns,2) 790 assert self.processor.entryExists( 791 dict(reg_number='1', level='100', code='COURSE1'), self.app) is False 792 shutil.rmtree(os.path.dirname(fin_file)) 793 logcontent = open(self.logfile).read() 794 self.assertTrue( 795 'INFO - system - K1000000 - Course ticket in 100 removed: COURSE1' 796 in logcontent) 778 797 779 798 class PaymentProcessorTest(StudentImportExportSetup):
Note: See TracChangeset for help on using the changeset viewer.