Changeset 12976


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

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

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

Legend:

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

    r12799 r12976  
    156156
    157157    def update(self):
    158         super(CustomInterswitchPageApplicant, self).update()
     158        error = self.init_update()
     159        if error:
     160            self.flash(error, type='danger')
     161            self.redirect(self.url(self.context, '@@index'))
     162            return
    159163        xmldict = {}
    160164        # Provider data
  • main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch/tests.py

    r12662 r12976  
    1717##
    1818import os
    19 from datetime import datetime
     19from datetime import datetime, timedelta, date
    2020from zope.component import getUtility
    2121from zope.catalog.interfaces import ICatalog
     
    6767            '<span>14975.0</span>' in self.browser.contents)
    6868        self.payment_url = self.browser.url
     69        self.payment = self.student['payments'][self.value]
    6970
    7071
     
    245246        self.assertFalse("BT Education" in self.browser.contents)
    246247
     248    def test_interswitch_form_ticket_expired(self):
     249        # Manager can access InterswitchForm
     250        self.browser.getLink("CollegePAY", index=0).click()
     251        self.assertMatches('...<input type="hidden" name="pay_item_id" value="8302" />...',
     252                           self.browser.contents)
     253        self.assertMatches('...Total Amount Authorized:...',
     254                           self.browser.contents)
     255        self.assertEqual(self.student.current_mode, 'nce_ft')
     256        self.assertMatches(
     257            '...<input type="hidden" name="amount" value="4000000" />...',
     258            self.browser.contents)
     259        delta = timedelta(minutes=61)
     260        self.payment.creation_date -= delta
     261        self.browser.open(self.payment_url)
     262        self.browser.getLink("CollegePAY", index=0).click()
     263        self.assertMatches(
     264            '...This payment ticket is too old. Please create a new ticket...',
     265            self.browser.contents)
     266        delta = timedelta(minutes=2)
     267        self.payment.creation_date += delta
     268        self.browser.open(self.payment_url)
     269        self.browser.getLink("CollegePAY", index=0).click()
     270        self.assertMatches('...Total Amount Authorized:...',
     271                           self.browser.contents)
     272
    247273#    @external_test
    248274#    def test_callback(self):
     
    376402            ' item_amt="35000" bank_id="117" acct_num="1013780934" />'
    377403            in self.browser.contents)
     404        delta = timedelta(minutes=61)
     405        self.applicant[self.value].creation_date -= delta
     406        self.browser.open(self.payment_url)
     407        self.browser.getLink("CollegePAY", index=0).click()
     408        self.assertMatches(
     409            '...This payment ticket is too old. Please create a new ticket...',
     410            self.browser.contents)
    378411
    379412    @external_test
Note: See TracChangeset for help on using the changeset viewer.