Ignore:
Timestamp:
30 Oct 2013, 19:43:48 (11 years ago)
Author:
Henrik Bettermann
Message:

New students must book and pay for accommodation first, before making school fee payments.

File:
1 edited

Legend:

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

    r10672 r10675  
    2828from waeup.kofa.configuration import SessionConfiguration
    2929from waeup.kwarapoly.testing import FunctionalLayer
     30from waeup.kwarapoly.students.payments import CustomStudentOnlinePayment
    3031
    3132# Also run tests that send requests to external servers?
     
    7677        notify(grok.ObjectModifiedEvent(self.student))
    7778
     79
     80    def test_schoolfee_ticket_creation(self):
    7881        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    7982        self.browser.open(self.payments_path)
     
    8285        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    8386        self.browser.getControl("Create ticket").click()
     87        self.assertMatches('...Book and pay for accommodation first...',
     88                           self.browser.contents)
     89        # We add a fake maint. payment ticket to meet the condition
     90        maint_payment = CustomStudentOnlinePayment()
     91        self.student['payments']['any_key'] = maint_payment
     92        maint_payment.p_category = 'hostel_maintenance'
     93        maint_payment.p_state = 'unpaid'
     94        maint_payment.p_session = 2004
     95        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     96        self.browser.getControl("Create ticket").click()
     97        self.assertMatches('...Book and pay for accommodation first...',
     98                           self.browser.contents)
     99        # Ticket must be paid
     100        maint_payment.p_state = 'paid'
     101        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     102        self.browser.getControl("Create ticket").click()
    84103        self.assertMatches('...ticket created...',
    85104                           self.browser.contents)
    86105        ctrl = self.browser.getControl(name='val_id')
    87         self.value = ctrl.options[0]
     106        self.value = ctrl.options[1]
    88107        self.browser.getLink(self.value).click()
    89108        self.assertMatches('...Amount Authorized...',
     
    107126
    108127    def test_interswitch_form(self):
     128
     129        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     130        self.browser.open(self.payments_path)
     131        # In KwaraPoly only returning students can create school fee payment
     132        # without haveing paid accommodation fee
     133        IWorkflowState(self.student).setState('returning')
     134        configuration = createObject('waeup.SessionConfiguration')
     135        configuration.academic_session = 2005
     136        self.app['configuration'].addSessionConfiguration(configuration)
     137        self.browser.open(self.payments_path + '/addop')
     138        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     139        self.browser.getControl("Create ticket").click()
     140        self.assertMatches('...ticket created...', self.browser.contents)
     141        ctrl = self.browser.getControl(name='val_id')
     142        self.value = ctrl.options[0]
     143        self.browser.getLink(self.value).click()
     144        self.assertMatches('...Amount Authorized...', self.browser.contents)
     145        self.assertMatches(
     146            '...<span>29500.0</span>...',
     147            self.browser.contents)
     148        self.payment_url = self.browser.url
     149
    109150        # Manager can access InterswitchForm
    110151        self.assertEqual(self.student['payments'][self.value].provider_amt, 0.0)
     
    119160                           self.browser.contents)
    120161        self.assertTrue(
    121             '<input type="hidden" name="amount" value="3940000.0" />' in
    122             self.browser.contents)
    123         self.assertTrue(
    124             'item_name="School Fee" item_amt="3610000" bank_id="120" acct_num="1771180233"' in
     162            '<input type="hidden" name="amount" value="2950000.0" />' in
     163            self.browser.contents)
     164        self.assertTrue(
     165            'item_name="School Fee" item_amt="2620000" bank_id="120" acct_num="1771180233"' in
    125166            self.browser.contents)
    126167        self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.