source: main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/tests/test_utils.py @ 15322

Last change on this file since 15322 was 14658, checked in by Henrik Bettermann, 8 years ago

Decrease Interswitch surcharge.

File size: 2.8 KB
Line 
1# -*- coding: utf-8 -*-
2from hurry.workflow.interfaces import IWorkflowState
3from zope.component import getUtility, createObject
4from waeup.kofa.testing import FunctionalTestCase
5from waeup.kofa.university.faculty import Faculty
6from waeup.kofa.university.department import Department
7from waeup.kofa.students.student import Student
8from waeup.kofa.students.interfaces import IStudentsUtils
9from waeup.kofa.students.tests.test_browser import StudentsFullSetup
10from kofacustom.coewarri.testing import FunctionalLayer
11
12class StudentsUtilsTests(StudentsFullSetup):
13
14    layer = FunctionalLayer
15
16    def test_set_payment_details(self):
17        self.student['studycourse'].entry_mode = 'ug_ft'
18        self.student.nationality = u'NG'
19        self.student.lga = 'ebonyi_ukaba'
20        self.student['studycourse'].current_session = 2016
21        self.student['studycourse'].entry_session = 2016
22        utils = getUtility(IStudentsUtils)
23
24        configuration = createObject('waeup.SessionConfiguration')
25        configuration.academic_session = 2016
26        self.app['configuration'].addSessionConfiguration(configuration)
27        self.app['configuration']['2016'].clearance_fee_1 = 10300.0
28        self.app['configuration']['2016'].clearance_fee_2 = 20300.0
29
30        error, payment = utils.setPaymentDetails('schoolfee',self.student)
31        self.assertEqual(payment.p_level, 100)
32        self.assertEqual(payment.p_session, 2016)
33        self.assertEqual(payment.amount_auth, 79450.0)
34        self.assertEqual(payment.p_item, u'CERT1')
35        self.assertEqual(error, None)
36
37        error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
38        self.assertEqual(payment.p_level, 100)
39        self.assertEqual(payment.p_session, 2016)
40        self.assertEqual(payment.amount_auth, 39850.0)
41        self.assertEqual(payment.p_item, u'CERT1')
42        self.assertEqual(error, None)
43
44        error, payment = utils.setPaymentDetails('schoolfee_2',self.student)
45        self.assertEqual(payment.p_level, 100)
46        self.assertEqual(payment.p_session, 2016)
47        self.assertEqual(payment.amount_auth, 39850.0)
48        self.assertEqual(payment.p_item, u'CERT1')
49        self.assertEqual(error, None)
50
51        error, payment = utils.setPaymentDetails('clearance',self.student)
52        self.assertEqual(payment.amount_auth, 25300.0)
53        self.assertEqual(payment.p_item, u'CERT1')
54
55        self.student.lga = 'delta_burutu'
56        error, payment = utils.setPaymentDetails('schoolfee',self.student)
57        self.assertEqual(payment.amount_auth, 69450.0)
58        error, payment = utils.setPaymentDetails('clearance',self.student)
59        self.assertEqual(payment.amount_auth, 20300.0)
60
61        self.student['studycourse'].entry_mode = 'nce_ft'
62        error, payment = utils.setPaymentDetails('clearance',self.student)
63        self.assertEqual(payment.amount_auth, 10300.0)
64        return
Note: See TracBrowser for help on using the repository browser.