- Timestamp:
- 30 Oct 2013, 19:43:48 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/tests.py
r10672 r10675 28 28 from waeup.kofa.configuration import SessionConfiguration 29 29 from waeup.kwarapoly.testing import FunctionalLayer 30 from waeup.kwarapoly.students.payments import CustomStudentOnlinePayment 30 31 31 32 # Also run tests that send requests to external servers? … … 76 77 notify(grok.ObjectModifiedEvent(self.student)) 77 78 79 80 def test_schoolfee_ticket_creation(self): 78 81 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 79 82 self.browser.open(self.payments_path) … … 82 85 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 83 86 self.browser.getControl("Create ticket").click() 87 self.assertMatches('...Book and pay for accommodation first...', 88 self.browser.contents) 89 # We add a fake maint. payment ticket to meet the condition 90 maint_payment = CustomStudentOnlinePayment() 91 self.student['payments']['any_key'] = maint_payment 92 maint_payment.p_category = 'hostel_maintenance' 93 maint_payment.p_state = 'unpaid' 94 maint_payment.p_session = 2004 95 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 96 self.browser.getControl("Create ticket").click() 97 self.assertMatches('...Book and pay for accommodation first...', 98 self.browser.contents) 99 # Ticket must be paid 100 maint_payment.p_state = 'paid' 101 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 102 self.browser.getControl("Create ticket").click() 84 103 self.assertMatches('...ticket created...', 85 104 self.browser.contents) 86 105 ctrl = self.browser.getControl(name='val_id') 87 self.value = ctrl.options[ 0]106 self.value = ctrl.options[1] 88 107 self.browser.getLink(self.value).click() 89 108 self.assertMatches('...Amount Authorized...', … … 107 126 108 127 def test_interswitch_form(self): 128 129 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 130 self.browser.open(self.payments_path) 131 # In KwaraPoly only returning students can create school fee payment 132 # without haveing paid accommodation fee 133 IWorkflowState(self.student).setState('returning') 134 configuration = createObject('waeup.SessionConfiguration') 135 configuration.academic_session = 2005 136 self.app['configuration'].addSessionConfiguration(configuration) 137 self.browser.open(self.payments_path + '/addop') 138 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 139 self.browser.getControl("Create ticket").click() 140 self.assertMatches('...ticket created...', self.browser.contents) 141 ctrl = self.browser.getControl(name='val_id') 142 self.value = ctrl.options[0] 143 self.browser.getLink(self.value).click() 144 self.assertMatches('...Amount Authorized...', self.browser.contents) 145 self.assertMatches( 146 '...<span>29500.0</span>...', 147 self.browser.contents) 148 self.payment_url = self.browser.url 149 109 150 # Manager can access InterswitchForm 110 151 self.assertEqual(self.student['payments'][self.value].provider_amt, 0.0) … … 119 160 self.browser.contents) 120 161 self.assertTrue( 121 '<input type="hidden" name="amount" value=" 3940000.0" />' in122 self.browser.contents) 123 self.assertTrue( 124 'item_name="School Fee" item_amt=" 3610000" bank_id="120" acct_num="1771180233"' in162 '<input type="hidden" name="amount" value="2950000.0" />' in 163 self.browser.contents) 164 self.assertTrue( 165 'item_name="School Fee" item_amt="2620000" bank_id="120" acct_num="1771180233"' in 125 166 self.browser.contents) 126 167 self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.