Ignore:
Timestamp:
21 May 2015, 21:20:53 (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.uniben/trunk/src/waeup/uniben/interswitch/tests.py

    r12566 r12980  
    1717##
    1818import os
    19 from datetime import datetime
     19from datetime import datetime, date, timedelta
    2020from zope.component import createObject, getUtility
    2121from zope.catalog.interfaces import ICatalog
     
    321321#        self.assertMatches('...Valid callback received...',
    322322#                          self.browser.contents)
     323
     324    def test_interswitch_form_ticket_expired(self):
     325        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     326        acc_payment = createObject('waeup.StudentOnlinePayment')
     327        acc_payment.p_state = 'unpaid'
     328        acc_payment.p_category = 'clearance'
     329        acc_payment.p_id = 'xyz'
     330        acc_payment.pay_item_id = '123'
     331        acc_payment.amount_auth = 876.0
     332        self.student['payments']['xyz'] = acc_payment
     333        self.browser.open(self.payments_path + '/xyz')
     334        self.browser.getLink("CollegePAY", index=0).click()
     335        self.assertMatches('...<input type="hidden" name="pay_item_id" value="5702" />...',
     336                           self.browser.contents)
     337        self.assertMatches('...Total Amount Authorized:...',
     338                           self.browser.contents)
     339        self.assertEqual(self.student.current_mode, 'ug_ft')
     340        self.assertMatches(
     341            '...<input type="hidden" name="amount" value="87600" />...',
     342            self.browser.contents)
     343        delta = timedelta(minutes=61)
     344        acc_payment.creation_date -= delta
     345        self.browser.open(self.payments_path + '/xyz')
     346        self.browser.getLink("CollegePAY", index=0).click()
     347        self.assertMatches(
     348            '...This payment ticket is too old. Please create a new ticket...',
     349            self.browser.contents)
     350        delta = timedelta(minutes=2)
     351        acc_payment.creation_date += delta
     352        self.browser.open(self.payments_path + '/xyz')
     353        self.browser.getLink("CollegePAY", index=0).click()
     354        self.assertMatches('...Total Amount Authorized:...',
     355                           self.browser.contents)
    323356
    324357    def test_pay_twice(self):
     
    454487            '...<input type="hidden" name="amount" value="100000" />...',
    455488            self.browser.contents)
     489        delta = timedelta(minutes=61)
     490        self.applicant.values()[0].creation_date -= delta
     491        self.browser.open(self.payment_url)
     492        self.browser.getLink("CollegePAY", index=0).click()
     493        self.assertMatches(
     494            '...This payment ticket is too old. Please create a new ticket...',
     495            self.browser.contents)
    456496
    457497    @external_test
Note: See TracChangeset for help on using the changeset viewer.