Ignore:
Timestamp:
13 Feb 2025, 11:36:26 (2 days ago)
Author:
Henrik Bettermann
Message:

Implement payment ticket exporter with date range filter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py

    r17766 r18021  
    2222from waeup.kofa.testing import KofaUnitTestLayer, FunctionalLayer
    2323from waeup.kofa.utils.utils import KofaUtils
     24
     25curr_year = datetime.datetime.now().year
    2426
    2527class ApplicantsContainersExporterTest(unittest.TestCase):
     
    319321    def test_export_filtered(self):
    320322        self.applicant = self.setup_applicant(self.applicant)
     323        cdate = str('%s#' % self.applicant['p120'].creation_date)
     324        self.applicant['p120'].payment_date = datetime.datetime(
     325            curr_year-6, 4, 1, 14, 12, 1)
    321326        exporter = ApplicantPaymentExporter()
    322327        exporter.export_filtered(
    323328            self.app, self.outfile, container=self.container.code)
    324329        result = open(self.outfile, 'rb').read()
    325         cdate = str('%s#' % self.applicant['p120'].creation_date)
    326330        self.assertEqual(
    327331            'ac,amount_auth,creation_date,p_category,p_combi,p_id,'
    328332            'p_item,p_session,p_state,payment_date,r_amount_approved,'
    329333            'r_code,r_desc,applicant_id,reg_number,display_fullname\r\n'
    330             ',0.0,%s,application,[],p120,,2012,paid,,0.0,,,dp2011_654321,'
     334            ',0.0,%s,application,[],p120,,2012,paid,2019-04-01 14:12:01#,0.0,'
     335            ',,dp2011_654321,'
     336            '123456,Anna M. Tester\r\n' % cdate, result)
     337        exporter.export_filtered(
     338            self.app, self.outfile, container=self.container.code,
     339            p_start='03/02/2025', p_end='04/02/2025')
     340        result = open(self.outfile, 'rb').read()
     341        self.assertEqual(
     342            'ac,amount_auth,creation_date,p_category,p_combi,p_id,'
     343            'p_item,p_session,p_state,payment_date,r_amount_approved,'
     344            'r_code,r_desc,applicant_id,reg_number,display_fullname\r\n',
     345            result)
     346        exporter.export_filtered(
     347            self.app, self.outfile, container=self.container.code,
     348            p_start='03/02/2019', p_end='04/05/2019')
     349        result = open(self.outfile, 'rb').read()
     350        self.assertEqual(
     351            'ac,amount_auth,creation_date,p_category,p_combi,p_id,'
     352            'p_item,p_session,p_state,payment_date,r_amount_approved,'
     353            'r_code,r_desc,applicant_id,reg_number,display_fullname\r\n'
     354            ',0.0,%s,application,[],p120,,2012,paid,2019-04-01 14:12:01#,0.0,'
     355            ',,dp2011_654321,'
    331356            '123456,Anna M. Tester\r\n' % cdate, result)
    332357        return
Note: See TracChangeset for help on using the changeset viewer.