Changeset 12978


Ignore:
Timestamp:
21 May 2015, 20:50:04 (9 years ago)
Author:
Henrik Bettermann
Message:

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

Location:
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/browser.py

    r12061 r12978  
    227227
    228228    def update(self):
    229         super(CustomInterswitchPageApplicant, self).update()
     229        error = self.init_update()
     230        if error:
     231            self.flash(error, type='danger')
     232            self.redirect(self.url(self.context, '@@index'))
     233            return
    230234        xmldict = {}
    231235        provider_amt = 300.0
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/tests.py

    r12148 r12978  
    389389
    390390
     391    def test_interswitch_form_ticket_expired(self):
     392        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     393        acc_payment = createObject('waeup.StudentOnlinePayment')
     394        acc_payment.p_state = 'unpaid'
     395        acc_payment.p_category = 'clearance'
     396        acc_payment.p_id = 'xyz'
     397        acc_payment.pay_item_id = '123'
     398        acc_payment.amount_auth = 876.0
     399        self.student['payments']['xyz'] = acc_payment
     400        self.browser.open(self.payments_path + '/xyz')
     401        self.browser.getLink("CollegePAY", index=0).click()
     402        self.assertMatches('...<input type="hidden" name="pay_item_id" value="000" />...',
     403                           self.browser.contents)
     404        self.assertMatches('...Total Amount Authorized:...',
     405                           self.browser.contents)
     406        self.assertEqual(self.student.current_mode, 'nd_ft')
     407        self.assertMatches(
     408            '...<input type="hidden" name="amount" value="87600" />...',
     409            self.browser.contents)
     410        delta = timedelta(minutes=61)
     411        acc_payment.creation_date -= delta
     412        self.browser.open(self.payments_path + '/xyz')
     413        self.browser.getLink("CollegePAY", index=0).click()
     414        self.assertMatches(
     415            '...This payment ticket is too old. Please create a new ticket...',
     416            self.browser.contents)
     417        delta = timedelta(minutes=2)
     418        acc_payment.creation_date += delta
     419        self.browser.open(self.payments_path + '/xyz')
     420        self.browser.getLink("CollegePAY", index=0).click()
     421        self.assertMatches('...Total Amount Authorized:...',
     422                           self.browser.contents)
     423
    391424    @external_test
    392425    def test_webservice(self):
     
    628661            in self.browser.contents)
    629662
     663    def test_interswitch_form_ticket_expired(self):
     664        # Manager can access InterswitchForm
     665        self.browser.getLink("CollegePAY", index=0).click()
     666        self.assertMatches('...Total Amount Authorized:...',
     667                           self.browser.contents)
     668        self.assertTrue(
     669            '<input type="hidden" name="amount" value="333300" />'
     670            in self.browser.contents)
     671        self.assertTrue(
     672            '<item_detail item_id="1" item_name="Application" '
     673            'item_amt="253300" bank_id="120" acct_num="1771440667" />'
     674            in self.browser.contents)
     675        delta = timedelta(minutes=61)
     676        self.applicant.values()[0].creation_date -= delta
     677        self.browser.open(self.payment_url)
     678        self.browser.getLink("CollegePAY", index=0).click()
     679        self.assertMatches(
     680            '...This payment ticket is too old. Please create a new ticket...',
     681            self.browser.contents)
     682
    630683    def prepare_special_container(self):
    631684        # Add special application container
Note: See TracChangeset for help on using the changeset viewer.