1 | # -*- coding: utf-8 -*- |
---|
2 | from hurry.workflow.interfaces import IWorkflowState |
---|
3 | from zope.component import getUtility, createObject |
---|
4 | from waeup.kofa.testing import FunctionalTestCase |
---|
5 | from waeup.kofa.university.faculty import Faculty |
---|
6 | from waeup.kofa.university.department import Department |
---|
7 | from waeup.kofa.students.student import Student |
---|
8 | from waeup.kofa.students.interfaces import IStudentsUtils |
---|
9 | from waeup.kofa.students.tests.test_browser import StudentsFullSetup |
---|
10 | from kofacustom.coewarri.testing import FunctionalLayer |
---|
11 | |
---|
12 | class StudentsUtilsTests(StudentsFullSetup): |
---|
13 | |
---|
14 | layer = FunctionalLayer |
---|
15 | |
---|
16 | def test_set_payment_details(self): |
---|
17 | self.student['studycourse'].certificate.study_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 = 10234.0 |
---|
28 | |
---|
29 | error, payment = utils.setPaymentDetails('schoolfee',self.student) |
---|
30 | self.assertEqual(payment.p_level, 100) |
---|
31 | self.assertEqual(payment.p_session, 2016) |
---|
32 | self.assertEqual(payment.amount_auth, 79500.0) |
---|
33 | self.assertEqual(payment.p_item, u'CERT1') |
---|
34 | self.assertEqual(error, None) |
---|
35 | |
---|
36 | error, payment = utils.setPaymentDetails('schoolfee_1',self.student) |
---|
37 | self.assertEqual(payment.p_level, 100) |
---|
38 | self.assertEqual(payment.p_session, 2016) |
---|
39 | self.assertEqual(payment.amount_auth, 39900.0) |
---|
40 | self.assertEqual(payment.p_item, u'CERT1') |
---|
41 | self.assertEqual(error, None) |
---|
42 | |
---|
43 | error, payment = utils.setPaymentDetails('schoolfee_2',self.student) |
---|
44 | self.assertEqual(payment.p_level, 100) |
---|
45 | self.assertEqual(payment.p_session, 2016) |
---|
46 | self.assertEqual(payment.amount_auth, 39900.0) |
---|
47 | self.assertEqual(payment.p_item, u'CERT1') |
---|
48 | self.assertEqual(error, None) |
---|
49 | |
---|
50 | error, payment = utils.setPaymentDetails('clearance',self.student) |
---|
51 | self.assertEqual(payment.amount_auth, 15234.0) |
---|
52 | self.assertEqual(payment.p_item, u'CERT1') |
---|
53 | |
---|
54 | self.student.lga = 'delta_burutu' |
---|
55 | error, payment = utils.setPaymentDetails('schoolfee',self.student) |
---|
56 | self.assertEqual(payment.amount_auth, 69500.0) |
---|
57 | error, payment = utils.setPaymentDetails('clearance',self.student) |
---|
58 | self.assertEqual(payment.amount_auth, 10234.0) |
---|
59 | return |
---|