Ignore:
Timestamp:
30 Oct 2016, 10:47:18 (8 years ago)
Author:
Henrik Bettermann
Message:

Enable instalment payments for returning students.

File:
1 edited

Legend:

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

    r14238 r14241  
    224224
    225225    def test_for_instalment_payments(self):
     226
     227        configuration_1 = createObject('waeup.SessionConfiguration')
     228        configuration_1.academic_session = 2015
     229        self.app['configuration'].addSessionConfiguration(configuration_1)
    226230        self.student['studycourse'].certificate.study_mode = 'ug_pt'
    227231        self.student['studycourse'].certificate.school_fee_1 = 6666.0
    228         self.app['configuration']['2004'].union_fee = 1250.0
    229         self.app['configuration']['2004'].welfare_fee = 750.0
     232        self.app['configuration']['2015'].union_fee = 1250.0
     233        self.app['configuration']['2015'].welfare_fee = 750.0
    230234        self.student.nationality = u'NG'
    231235        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    239243        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
    240244        self.browser.getControl("Create ticket").click()
    241         self.assertTrue(
    242             'Wrong state. Only students in state \'cleared\' are allowed to pay by instalments'
     245        self.assertTrue('You are not allowed to pay by instalments.'
    243246            in self.browser.contents)
    244247        IWorkflowState(self.student).setState('cleared')
     248        self.student['studycourse'].entry_session = 2015
     249        self.student['studycourse'].current_session = 2015
    245250        self.browser.open(self.payments_path + '/addop')
    246251        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     
    274279        # (6666-250)/2 + 250
    275280        self.assertEqual(self.student['payments'].values()[1].amount_auth, 3458.0)
     281        # The  two payments belong to the same session and level.
     282        self.assertEqual(self.student['payments'].values()[0].p_session, 2015)
     283        self.assertEqual(self.student['payments'].values()[0].p_level, 100)
     284        self.assertEqual(self.student['payments'].values()[1].p_session, 2015)
     285        self.assertEqual(self.student['payments'].values()[1].p_level, 100)
     286
     287        # Returning student
     288        configuration_2 = createObject('waeup.SessionConfiguration')
     289        configuration_2.academic_session = 2016
     290        self.app['configuration'].addSessionConfiguration(configuration_2)
     291        self.student['studycourse'].certificate.school_fee_2 = 5666.0
     292        self.app['configuration']['2016'].union_fee = 1250.0
     293        self.app['configuration']['2016'].welfare_fee = 750.0
     294        self.student.father_name = u'Albert'
     295        IWorkflowState(self.student).setState('returning')
     296        self.browser.open(self.payments_path + '/addop')
     297        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     298        self.browser.getControl("Create ticket").click()
     299        self.browser.open(self.payments_path + '/addop')
     300        self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
     301        self.browser.getControl("Create ticket").click()
     302        # Student is still in the first  session.
     303        self.assertTrue('This type of payment' in self.browser.contents)
     304        self.browser.open(self.payments_path)
     305        ctrl = self.browser.getControl(name='val_id')
     306        p_id = ctrl.options[2]
     307        self.browser.open(self.payments_path + '/' + p_id + '/approve')
     308        self.browser.open(self.payments_path + '/addop')
     309        self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
     310        self.browser.getControl("Create ticket").click()
     311        self.assertTrue('ticket created' in self.browser.contents)
     312        # (5666-250)/2 + 1250 + 750 - 500 + 250
     313        self.assertEqual(self.student['payments'].values()[2].amount_auth, 4458.0)
     314        # (5666-250)/2 + 250
     315        self.assertEqual(self.student['payments'].values()[3].amount_auth, 2958.0)
     316        # The last two payments belong to the same session and level.
     317        self.assertEqual(self.student['payments'].values()[2].p_session, 2016)
     318        self.assertEqual(self.student['payments'].values()[2].p_level, 200)
     319        self.assertEqual(self.student['payments'].values()[3].p_session, 2016)
     320        self.assertEqual(self.student['payments'].values()[3].p_level, 200)
    276321        return
    277322
     
    711756    def test_student_2nd_semester_course_registration(self):
    712757        IWorkflowState(self.student).setState('school fee paid')
     758        self.student['studycourse'].entry_session = 2015
    713759        self.course.semester = 2
    714760        self.browser.open(self.login_path)
Note: See TracChangeset for help on using the changeset viewer.