Ignore:
Timestamp:
3 Jul 2012, 10:41:09 (12 years ago)
Author:
Henrik Bettermann
Message:

Add tests for delEntry.

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

    r8885 r8886  
    618618        student = self.getParent(row, site).__parent__
    619619        student.__parent__.logger.info(
    620             '%s - %s - updated: %s'
    621             % (student.student_id, obj.p_id, items_changed))
     620            '%s - Payment ticket updated: %s'
     621            % (student.student_id, items_changed))
    622622        return
    623623
     
    638638        if payment is not None:
    639639            student = self._getStudent(row, site)
    640             student.__parent__.logger.info('%s - removed: %s'
     640            student.__parent__.logger.info('%s - Payment ticket removed: %s'
    641641                % (student.student_id, payment.p_id))
    642642            del parent[payment.p_id]
    643         pass
     643        return
    644644
    645645    def checkConversion(self, row, mode='ignore'):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r8884 r8886  
    825825            self.app) is self.student['payments']['p120']
    826826
     827    def test_delEntry(self):
     828        assert self.processor.getEntry(
     829            dict(student_id=self.student.student_id, p_id='p120'),
     830            self.app) is self.student['payments']['p120']
     831        self.assertEqual(len(self.student['payments'].keys()),1)
     832        self.processor.delEntry(
     833            dict(student_id=self.student.student_id, p_id='p120'),
     834            self.app)
     835        assert self.processor.getEntry(
     836            dict(student_id=self.student.student_id, p_id='p120'),
     837            self.app) is None
     838        self.assertEqual(len(self.student['payments'].keys()),0)
     839
    827840    def test_addEntry(self):
    828841        self.assertEqual(len(self.student['payments'].keys()),1)
     
    870883        self.assertEqual(str(payment.creation_date.tzinfo),'UTC')
    871884        shutil.rmtree(os.path.dirname(fin_file))
    872 
    873885        logcontent = open(self.logfile).read()
    874         # Logging message from updateEntry,
     886        # Logging message from updateEntry
    875887        self.assertTrue(
    876888            'INFO - system - K1000001 - Payment ticket updated: '
     
    891903        self.assertEqual(num_warns,0)
    892904        shutil.rmtree(os.path.dirname(fin_file))
     905
     906    def test_import_remove(self):
     907        num, num_warns, fin_file, fail_file = self.processor.doImport(
     908            self.csv_file, PAYMENT_HEADER_FIELDS,'create')
     909        num, num_warns, fin_file, fail_file = self.processor.doImport(
     910            self.csv_file, PAYMENT_HEADER_FIELDS,'remove')
     911        self.assertEqual(num_warns,0)
     912        shutil.rmtree(os.path.dirname(fin_file))
     913        logcontent = open(self.logfile).read()
     914        self.assertTrue(
     915            'INFO - system - K1000001 - Payment ticket removed: p1266236341955'
     916            in logcontent)
    893917
    894918    def test_import_wo_pid(self):
Note: See TracChangeset for help on using the changeset viewer.