Ignore:
Timestamp:
30 Nov 2015, 14:56:37 (9 years ago)
Author:
Henrik Bettermann
Message:

Implement school fee payments by instalment.

File:
1 edited

Legend:

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

    r13489 r13512  
    178178        self.assertMatches('...ticket created...',
    179179                           self.browser.contents)
    180 
    181     def deactivated_test_for_instalment_payments(self):
     180        return
     181
     182    def test_for_instalment_payments(self):
     183        self.student['studycourse'].certificate.school_fee_1 = 6666.0
     184        self.app['configuration']['2004'].union_fee = 1250.0
     185        self.app['configuration']['2004'].welfare_fee = 750.0
     186        self.student.nationality = u'NG'
    182187        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    183         self.browser.open(self.payments_path)
    184188        self.browser.open(self.payments_path + '/addop')
    185189        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
    186190        self.browser.getControl("Create ticket").click()
    187         self.assertMatches('...ticket created...',
    188                            self.browser.contents)
     191        self.assertTrue(
     192            'Wrong state. Only students in state \'cleared\' are allowed to pay by instalments'
     193            in self.browser.contents)
     194        IWorkflowState(self.student).setState('cleared')
     195        self.browser.open(self.payments_path + '/addop')
     196        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     197        self.browser.getControl("Create ticket").click()
     198        self.assertTrue('ticket created' in self.browser.contents)
    189199        # We can't add the 2nd instalment ticket because the
    190200        # first one has not yet been approved.
    191         self.browser.open(self.payments_path + '/addop')
    192         self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
    193         self.browser.getControl("Create ticket").click()
    194         self.assertMatches('...1st school fee instalment has not yet been paid...',
    195                            self.browser.contents)
     201        #self.browser.open(self.payments_path + '/addop')
     202        #self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
     203        #self.browser.getControl("Create ticket").click()
     204        #self.assertMatches('...1st school fee instalment has not yet been paid...',
     205        #                   self.browser.contents)
    196206        # Ok, then we approve the first instalment ...
    197207        self.browser.open(self.payments_path)
     
    203213        self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
    204214        self.browser.getControl("Create ticket").click()
    205         self.assertMatches('...ticket created...',
    206                            self.browser.contents)
     215        self.assertTrue('ticket created' in self.browser.contents)
    207216        # ... approve the second instalment ...
    208217        ctrl = self.browser.getControl(name='val_id')
    209218        p_id = ctrl.options[1]
    210219        self.browser.open(self.payments_path + '/' + p_id + '/approve')
    211         # ... and finally add the 1st instalment for the next session
    212         # provided that student is returning.
    213         IWorkflowState(self.student).setState('returning')
    214         self.browser.open(self.payments_path + '/addop')
    215         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
    216         self.browser.getControl("Create ticket").click()
    217         self.assertMatches('...Session configuration object is not...',
    218                            self.browser.contents)
    219         # Uups, we forgot to add a session configuration for next session
    220         configuration = createObject('waeup.SessionConfiguration')
    221         configuration.academic_session = 2005
    222         self.app['configuration'].addSessionConfiguration(configuration)
    223         self.app['configuration']['2005'].school_base = 7777.0
    224         self.browser.open(self.payments_path + '/addop')
    225         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
    226         self.browser.getControl("Create ticket").click()
    227         self.assertMatches('...ticket created...',
    228                            self.browser.contents)
    229         # If the session configuration doesn't exist an error message will
    230         # be shown. No other requirement is being checked.
    231         del self.app['configuration']['2004']
    232         self.browser.open(self.payments_path)
    233         self.browser.getLink("Add current session payment ticket").click()
    234         self.browser.getControl("Create ticket").click()
    235         self.assertMatches('...Session configuration object is not...',
    236                            self.browser.contents)
     220        self.assertEqual(self.student['payments'].values()[0].p_category, 'schoolfee_1')
     221        self.assertEqual(self.student['payments'].values()[1].p_category, 'schoolfee_2')
     222        # 6666/2 + 1250 + 750 - 500
     223        self.assertEqual(self.student['payments'].values()[0].amount_auth, 4833.0)
     224        # 6666/2
     225        self.assertEqual(self.student['payments'].values()[1].amount_auth, 3333.0)
     226        return
    237227
    238228    def test_manage_payments_bypass_ac_creation(self):
Note: See TracChangeset for help on using the changeset viewer.