Changeset 14344 for main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/tests/test_browser.py
- Timestamp:
- 14 Dec 2016, 16:57:13 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/tests/test_browser.py
r14035 r14344 42 42 layer = FunctionalLayer 43 43 44 def test_dummytest(self): 44 def test_for_instalment_payments(self): 45 46 #configuration_1 = createObject('waeup.SessionConfiguration') 47 #configuration_1.academic_session = 2015 48 #self.app['configuration'].addSessionConfiguration(configuration_1) 49 self.student['studycourse'].certificate.study_mode = 'ug_ft' 50 self.student.nationality = u'NG' 51 # Fresh student 52 IWorkflowState(self.student).setState('cleared') 53 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 54 self.browser.open(self.payments_path + '/addop') 55 self.browser.open(self.payments_path + '/addop') 56 # Add first instalment 57 self.browser.getControl(name="form.p_category").value = ['schoolfee_1'] 58 self.browser.getControl("Create ticket").click() 59 self.assertTrue('ticket created' in self.browser.contents) 60 self.browser.open(self.payments_path) 61 ctrl = self.browser.getControl(name='val_id') 62 p_id = ctrl.options[0] 63 self.browser.open(self.payments_path + '/' + p_id + '/approve') 64 # Add the second instalment ... 65 self.browser.open(self.payments_path + '/addop') 66 self.browser.getControl(name="form.p_category").value = ['schoolfee_2'] 67 self.browser.getControl("Create ticket").click() 68 self.assertTrue('ticket created' in self.browser.contents) 69 # ... approve the second instalment ... 70 ctrl = self.browser.getControl(name='val_id') 71 p_id = ctrl.options[1] 72 self.browser.open(self.payments_path + '/' + p_id + '/approve') 73 self.assertEqual(self.student['payments'].values()[0].p_category, 'schoolfee_1') 74 self.assertEqual(self.student['payments'].values()[1].p_category, 'schoolfee_2') 75 # 79200 / 2 + 300 76 self.assertEqual(self.student['payments'].values()[0].amount_auth, 39900.0) 77 self.assertEqual(self.student['payments'].values()[1].amount_auth, 39900.0) 78 # The two payments belong to the same session and level. 79 self.assertEqual(self.student['payments'].values()[0].p_session, 2004) 80 self.assertEqual(self.student['payments'].values()[0].p_level, 100) 81 self.assertEqual(self.student['payments'].values()[1].p_session, 2004) 82 self.assertEqual(self.student['payments'].values()[1].p_level, 100) 83 84 # Returning student 85 configuration_2 = createObject('waeup.SessionConfiguration') 86 configuration_2.academic_session = 2005 87 self.app['configuration'].addSessionConfiguration(configuration_2) 88 IWorkflowState(self.student).setState('returning') 89 self.browser.open(self.payments_path + '/addop') 90 self.browser.getControl(name="form.p_category").value = ['schoolfee_1'] 91 self.browser.getControl("Create ticket").click() 92 self.browser.open(self.payments_path + '/addop') 93 self.browser.getControl(name="form.p_category").value = ['schoolfee_2'] 94 self.browser.getControl("Create ticket").click() 95 self.browser.open(self.payments_path) 96 ctrl = self.browser.getControl(name='val_id') 97 # Nothing happens if we approve the 2nd instalment for session 2005 98 self.browser.open(self.payments_path + '/' + ctrl.options[3] + '/approve') 99 self.assertEqual(self.student.state, 'returning') 100 # Workflow transition is trigered if we approve the 1st indtalment 101 self.browser.open(self.payments_path + '/' + ctrl.options[2] + '/approve') 102 self.assertEqual(self.student.state, 'school fee paid') 103 self.assertEqual(self.student.current_level, 200) 104 self.assertEqual(self.student.current_session, 2005) 105 # 63100 / 2 + 300 106 self.assertEqual(self.student['payments'].values()[2].amount_auth, 31850.0) 107 self.assertEqual(self.student['payments'].values()[3].amount_auth, 31850.0) 108 # The last two payments belong to the same session and level. 109 self.assertEqual(self.student['payments'].values()[2].p_session, 2005) 110 self.assertEqual(self.student['payments'].values()[2].p_level, 200) 111 self.assertEqual(self.student['payments'].values()[3].p_session, 2005) 112 self.assertEqual(self.student['payments'].values()[3].p_level, 200) 45 113 return
Note: See TracChangeset for help on using the changeset viewer.