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

Last change on this file was 16417, checked in by Henrik Bettermann, 4 years ago

Change FEES_VALUES and adjust all tests.

File size: 3.6 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, 85950.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, 43100.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, 43100.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, 75950.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
65
66    def test_warnCreditsOOR(self):
67        self.student['studycourse'].entry_mode = 'ug_ft'
68        studylevel = createObject(u'waeup.StudentStudyLevel')
69        studylevel.level = 100
70        studylevel.level_session = 2005
71        self.student['studycourse'].addStudentStudyLevel(
72            self.certificate, studylevel)
73        studylevel['COURSE1'].credits = 48
74        utils = getUtility(IStudentsUtils)
75        error = utils.warnCreditsOOR(self.student['studycourse']['100'])
76        self.assertFalse(error)
77        studylevel['COURSE1'].credits = 49
78        error = utils.warnCreditsOOR(studylevel)
79        self.assertEqual(error, 'Maximum credits exceeded.')
80        studylevel.level = 400
81        error = utils.warnCreditsOOR(studylevel)
82        self.assertFalse(error)
83        return
Note: See TracBrowser for help on using the repository browser.