Ignore:
Timestamp:
18 Aug 2017, 06:43:53 (7 years ago)
Author:
Henrik Bettermann
Message:

Allow ApplicantOnlinePaymentProcessor to import records without p_id column in create mode.

File:
1 edited

Legend:

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

    r13873 r14804  
    530530        num, num_warns, fin_file, fail_file = self.processor.doImport(
    531531            self.csv_file, PAYMENT_HEADER_FIELDS,'create')
    532         self.assertEqual(num_warns,1)
     532        self.assertEqual(num_warns,2)
    533533        fail_file = open(fail_file).read()
    534534        self.assertTrue('Payment has already been made' in fail_file)
     
    538538        num, num_warns, fin_file, fail_file = self.processor.doImport(
    539539            self.csv_file, PAYMENT_HEADER_FIELDS,'create')
     540        # Both records can be imported now.
    540541        self.assertEqual(num_warns,0)
     542        # One with imported and known p_id ...
    541543        payment = self.processor.getEntry(dict(applicant_id='dp2011_1234',
    542544            p_id='p1266236341955'), self.app)
     
    548550        self.assertEqual(cdate, '2010-11-25 21:16:33')
    549551        self.assertEqual(str(payment.creation_date.tzinfo),'UTC')
     552        # ... the other one with generated p_id.
     553        p_id_failed = self.applicant2.keys()[1]
     554        payment_failed = self.processor.getEntry(dict(applicant_id='dp2011_1234',
     555            p_id=p_id_failed), self.app)
     556        self.assertEqual(payment_failed.p_state, 'failed')
     557        self.assertEqual(payment_failed.amount_auth, 10500.1)
    550558        shutil.rmtree(os.path.dirname(fin_file))
    551559        logcontent = open(self.logfile).read()
     
    553561        self.assertTrue(
    554562            'INFO - system - ApplicantOnlinePayment Processor - dp2011_1234 - '
    555             'previous update cancelled'
    556             in logcontent)
     563            'previous update cancelled' in logcontent)
    557564        self.assertTrue(
    558565            'INFO - system - ApplicantOnlinePayment Processor - '
     
    560567            'creation_date=2010-11-25 21:16:33.757000+00:00, '
    561568            'r_amount_approved=19500.1, p_category=application, '
    562             'amount_auth=19500.1, p_session=2015, p_state=paid'
    563             in logcontent)
     569            'amount_auth=19500.1, p_session=2015, p_state=paid' in logcontent)
     570        self.assertTrue(
     571            'INFO - system - ApplicantOnlinePayment Processor - '
     572            'sample_payment_data - dp2011_1234 - updated: p_id=%s, '
     573            'creation_date=2011-11-25 21:16:33.757000+00:00, '
     574            'r_amount_approved=19500.1, p_category=application, '
     575            'amount_auth=10500.1, p_session=2016, p_state=failed'
     576            % p_id_failed in logcontent)
Note: See TracChangeset for help on using the changeset viewer.