Ignore:
Timestamp:
21 May 2015, 20:57:55 (10 years ago)
Author:
Henrik Bettermann
Message:

Test if the ticket-expire mechanism works, for both applicant and student payments.

Fix code.

Location:
main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/interswitch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/interswitch/browser.py

    r12511 r12979  
    6060
    6161    def update(self):
    62         super(CustomInterswitchPageStudent, self).update()
     62        error = self.init_update()
     63        if error:
     64            self.flash(error, type='danger')
     65            self.redirect(self.url(self.context, '@@index'))
     66            return
    6367        student = self.student
    6468        xmldict = self.xmldict
     
    120124
    121125    def update(self):
    122         super(CustomInterswitchPageApplicant, self).update()
     126        error = self.init_update()
     127        if error:
     128            self.flash(error, type='danger')
     129            self.redirect(self.url(self.context, '@@index'))
     130            return
    123131        xmldict = {}
    124132        provider_amt = 400.0
  • main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/interswitch/tests.py

    r12479 r12979  
    8383            '...item_name="School Fee" item_amt="4000000" bank_id="00" acct_num="00000000"...',
    8484            self.browser.contents)
     85
     86    def test_interswitch_form_ticket_expired(self):
     87        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     88        acc_payment = createObject('waeup.StudentOnlinePayment')
     89        acc_payment.p_state = 'unpaid'
     90        acc_payment.p_category = 'clearance'
     91        acc_payment.p_id = 'xyz'
     92        acc_payment.pay_item_id = '123'
     93        acc_payment.amount_auth = 876.0
     94        self.student['payments']['xyz'] = acc_payment
     95        self.browser.open(self.payments_path + '/xyz')
     96        self.browser.getLink("CollegePAY", index=0).click()
     97        self.assertMatches('...<input type="hidden" name="pay_item_id" value="0000" />...',
     98                           self.browser.contents)
     99        self.assertMatches('...Total Amount Authorized:...',
     100                           self.browser.contents)
     101        self.assertEqual(self.student.current_mode, 'ug_ft')
     102        self.assertMatches(
     103            '...<input type="hidden" name="amount" value="87600" />...',
     104            self.browser.contents)
     105        delta = timedelta(minutes=61)
     106        acc_payment.creation_date -= delta
     107        self.browser.open(self.payments_path + '/xyz')
     108        self.browser.getLink("CollegePAY", index=0).click()
     109        self.assertMatches(
     110            '...This payment ticket is too old. Please create a new ticket...',
     111            self.browser.contents)
     112        delta = timedelta(minutes=2)
     113        acc_payment.creation_date += delta
     114        self.browser.open(self.payments_path + '/xyz')
     115        self.browser.getLink("CollegePAY", index=0).click()
     116        self.assertMatches('...Total Amount Authorized:...',
     117                           self.browser.contents)
    85118
    86119    @external_test
     
    198231
    199232    def test_interswitch_form(self):
    200 
    201233        # Manager can access InterswitchForm
    202234        self.browser.getLink("CollegePAY", index=0).click()
     
    205237        self.assertMatches(
    206238            '...<input type="hidden" name="amount" value="100000" />...',
     239            self.browser.contents)
     240        delta = timedelta(minutes=61)
     241        self.applicant.values()[0].creation_date -= delta
     242        self.browser.open(self.payment_url)
     243        self.browser.getLink("CollegePAY", index=0).click()
     244        self.assertMatches(
     245            '...This payment ticket is too old. Please create a new ticket...',
    207246            self.browser.contents)
    208247
Note: See TracChangeset for help on using the changeset viewer.