Ignore:
Timestamp:
30 Apr 2013, 15:41:11 (12 years ago)
Author:
Henrik Bettermann
Message:

Configure application fee payment.

File:
1 edited

Legend:

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

    r9811 r10131  
    285285            '52100.0,00,1200.0,300.0,1800.0,,,\n'
    286286            in logcontent)
     287
     288
     289class InterswitchTestsApplicants(ApplicantsFullSetup):
     290    """Tests for the Interswitch payment gateway.
     291    """
     292
     293    layer = FunctionalLayer
     294
     295    def setUp(self):
     296        super(InterswitchTestsApplicants, self).setUp()
     297        # Create at least one Kwarapoly faculty
     298        self.app['faculties']['CPGS'] = Faculty(code='CPGS')
     299        self.app['faculties']['CPGS']['dep1'] = Department(code='dep1')
     300        self.certificate2 = createObject('waeup.Certificate')
     301        self.certificate2.code = u'CERT2'
     302        self.certificate2.application_category = 'nd'
     303        self.certificate2.study_mode = 'nd_ft'
     304        self.certificate2.start_level = 100
     305        self.certificate2.end_level = 300
     306        self.app['faculties']['CPGS']['dep1'].certificates.addCertificate(
     307            self.certificate2)
     308        self.applicantscontainer.application_category = 'nd'
     309        self.applicant.applicant_id = u'nd_anything'
     310       
     311        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     312        self.browser.open(self.manage_path)
     313        #IWorkflowState(self.student).setState('started')
     314        super(InterswitchTestsApplicants, self).fill_correct_values()
     315        self.browser.getControl(name="form.course1").value = ['CERT2']
     316        self.applicantscontainer.application_fee = 3333.0
     317        self.browser.getControl(name="form.nationality").value = ['NG']
     318        self.browser.getControl(name="transition").value = ['start']
     319        self.browser.getControl("Save").click()
     320        self.browser.getControl("Add online").click()
     321        self.assertMatches('...ticket created...',
     322                           self.browser.contents)
     323        #ctrl = self.browser.getControl(name='val_id')
     324        #value = ctrl.options[0]
     325        #self.browser.getLink(value).click()
     326        self.assertMatches('...Amount Authorized...',
     327                           self.browser.contents)
     328        self.assertMatches(
     329            '...<span>3333.0</span>...',
     330            self.browser.contents)
     331        self.payment_url = self.browser.url
     332
     333
     334    def test_interswitch_form(self):
     335
     336        # Manager can access InterswitchForm
     337        self.browser.getLink("CollegePAY", index=0).click()
     338        self.assertMatches('...Total Amount Authorized:...',
     339                           self.browser.contents)
     340        self.assertTrue(
     341            '<input type="hidden" name="amount" value="333300.0" />'
     342            in self.browser.contents)
     343        self.assertTrue(
     344            '<item_detail item_id="1" item_name="application" '
     345            'item_amt="253300" bank_id="8" acct_num="2014191363" />'
     346            in self.browser.contents)
     347
     348        # hnd fee goes to another account
     349        self.applicant.applicant_id = u'hnd_anything'
     350        self.browser.open(self.manage_path)
     351        ctrl = self.browser.getControl(name='val_id')
     352        value = ctrl.options[0]
     353        self.browser.getLink(value).click()
     354        self.browser.getLink("CollegePAY", index=0).click()
     355        self.assertTrue(
     356            '<item_detail item_id="1" item_name="application" '
     357            'item_amt="253300" bank_id="9" acct_num="7000016463" />'
     358            in self.browser.contents)
     359
Note: See TracChangeset for help on using the changeset viewer.