Changeset 12977


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py

    r12975 r12977  
    6666        self.assertMatches('...ticket created...',
    6767                           self.browser.contents)
    68         #ctrl = self.browser.getControl(name='val_id')
    69         #value = ctrl.options[0]
    7068        #self.browser.getLink(value).click()
    7169        self.assertMatches('...Amount Authorized...',
     
    7674        self.payment_url = self.browser.url
    7775
    78 
    7976    def test_interswitch_form(self):
    80 
    8177        # Manager can access InterswitchForm
    8278        self.browser.getLink("CollegePAY", index=0).click()
     
    8581        self.assertMatches(
    8682            '...<input type="hidden" name="amount" value="100000" />...',
     83            self.browser.contents)
     84        delta = timedelta(minutes=61)
     85        self.applicant.values()[0].creation_date -= delta
     86        self.browser.open(self.payment_url)
     87        self.browser.getLink("CollegePAY", index=0).click()
     88        self.assertMatches(
     89            '...This payment ticket is too old. Please create a new ticket...',
    8790            self.browser.contents)
    8891
     
    181184            '...item_name="Acceptance Fee" item_amt="4280000" bank_id="117" acct_num="1014066976"...',
    182185            self.browser.contents)
     186
     187    def test_interswitch_form_ticket_expired(self):
     188        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     189        acc_payment = createObject('waeup.StudentOnlinePayment')
     190        acc_payment.p_state = 'unpaid'
     191        acc_payment.p_category = 'clearance'
     192        acc_payment.p_id = 'xyz'
     193        acc_payment.pay_item_id = '123'
     194        acc_payment.amount_auth = 876.0
     195        self.student['payments']['xyz'] = acc_payment
     196        self.browser.open(self.payments_path + '/xyz')
     197        self.browser.getLink("CollegePAY", index=0).click()
     198        self.assertMatches('...<input type="hidden" name="pay_item_id" value="104" />...',
     199                           self.browser.contents)
     200        self.assertMatches('...Total Amount Authorized:...',
     201                           self.browser.contents)
     202        self.assertEqual(self.student.current_mode, 'ug_ft')
     203        self.assertMatches(
     204            '...<input type="hidden" name="amount" value="87600" />...',
     205            self.browser.contents)
     206        delta = timedelta(minutes=61)
     207        acc_payment.creation_date -= delta
     208        self.browser.open(self.payments_path + '/xyz')
     209        self.browser.getLink("CollegePAY", index=0).click()
     210        self.assertMatches(
     211            '...This payment ticket is too old. Please create a new ticket...',
     212            self.browser.contents)
     213        delta = timedelta(minutes=2)
     214        acc_payment.creation_date += delta
     215        self.browser.open(self.payments_path + '/xyz')
     216        self.browser.getLink("CollegePAY", index=0).click()
     217        self.assertMatches('...Total Amount Authorized:...',
     218                           self.browser.contents)
    183219
    184220    @external_test
Note: See TracChangeset for help on using the changeset viewer.