[12730] | 1 | ## $Id: tests.py 13438 2015-11-11 19:49:12Z henrik $ |
---|
[11846] | 2 | ## |
---|
| 3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
| 18 | import os |
---|
| 19 | from datetime import datetime, date, timedelta |
---|
| 20 | from zope.component import createObject, getUtility |
---|
| 21 | from zope.catalog.interfaces import ICatalog |
---|
| 22 | from hurry.workflow.interfaces import IWorkflowState |
---|
| 23 | from waeup.kofa.students.tests.test_browser import StudentsFullSetup |
---|
| 24 | from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup |
---|
| 25 | from waeup.kofa.configuration import SessionConfiguration |
---|
| 26 | from waeup.aaue.testing import FunctionalLayer |
---|
| 27 | |
---|
| 28 | # Also run tests that send requests to external servers? |
---|
| 29 | # If you enable this, please make sure the external services |
---|
| 30 | # do exist really and are not bothered by being spammed by a test programme. |
---|
[13388] | 31 | EXTERNAL_TESTS = False |
---|
[11846] | 32 | |
---|
| 33 | def external_test(func): |
---|
| 34 | if not EXTERNAL_TESTS: |
---|
| 35 | myself = __file__ |
---|
| 36 | if myself.endswith('.pyc'): |
---|
| 37 | myself = myself[:-2] |
---|
| 38 | print "WARNING: external tests are skipped!" |
---|
| 39 | print "WARNING: edit %s to enable them." % myself |
---|
| 40 | return |
---|
| 41 | return func |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | class InterswitchTestsApplicants(ApplicantsFullSetup): |
---|
| 45 | """Tests for the Interswitch payment gateway. |
---|
| 46 | """ |
---|
| 47 | |
---|
| 48 | layer = FunctionalLayer |
---|
| 49 | |
---|
| 50 | def setUp(self): |
---|
| 51 | super(InterswitchTestsApplicants, self).setUp() |
---|
| 52 | configuration = SessionConfiguration() |
---|
| 53 | configuration.academic_session = datetime.now().year - 2 |
---|
| 54 | self.app['configuration'].addSessionConfiguration(configuration) |
---|
| 55 | self.configuration = configuration |
---|
| 56 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 57 | self.browser.open(self.manage_path) |
---|
| 58 | #IWorkflowState(self.student).setState('started') |
---|
| 59 | super(InterswitchTestsApplicants, self).fill_correct_values() |
---|
| 60 | self.browser.getControl(name="form.programme_type").value = ['regular'] |
---|
| 61 | self.applicantscontainer.application_fee = 1000.0 |
---|
| 62 | self.browser.getControl(name="form.nationality").value = ['NG'] |
---|
| 63 | self.browser.getControl(name="transition").value = ['start'] |
---|
| 64 | self.browser.getControl("Save").click() |
---|
| 65 | self.browser.getControl("Add online").click() |
---|
[13381] | 66 | self.assertTrue('ticket created' in self.browser.contents) |
---|
[11846] | 67 | #self.browser.getLink(value).click() |
---|
[13381] | 68 | self.assertTrue('Amount Authorized' in self.browser.contents) |
---|
| 69 | self.assertTrue('<span>1000.0</span>' in self.browser.contents) |
---|
[11846] | 70 | self.payment_url = self.browser.url |
---|
| 71 | |
---|
| 72 | def test_interswitch_form(self): |
---|
| 73 | # Manager can access InterswitchForm |
---|
| 74 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[13381] | 75 | self.assertTrue('Total Amount Authorized:' in self.browser.contents) |
---|
| 76 | self.assertTrue( |
---|
| 77 | '<input type="hidden" name="amount" value="100000" />' |
---|
| 78 | in self.browser.contents) |
---|
[13017] | 79 | delta = timedelta(days=8) |
---|
[12977] | 80 | self.applicant.values()[0].creation_date -= delta |
---|
| 81 | self.browser.open(self.payment_url) |
---|
| 82 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[13381] | 83 | self.assertTrue( |
---|
| 84 | 'This payment ticket is too old. Please create a new ticket' |
---|
| 85 | in self.browser.contents) |
---|
[11846] | 86 | |
---|
| 87 | @external_test |
---|
| 88 | def test_webservice(self): |
---|
| 89 | |
---|
| 90 | self.browser.open(self.payment_url + '/request_webservice') |
---|
[13381] | 91 | self.assertTrue('Unsuccessful callback' in self.browser.contents) |
---|
[11846] | 92 | # The payment is now in state failed |
---|
[13381] | 93 | self.assertTrue('<span>Failed</span>' in self.browser.contents) |
---|
[11868] | 94 | |
---|
| 95 | class InterswitchTestsStudents(StudentsFullSetup): |
---|
| 96 | """Tests for the Interswitch payment gateway. |
---|
| 97 | """ |
---|
| 98 | |
---|
| 99 | layer = FunctionalLayer |
---|
| 100 | |
---|
| 101 | def setUp(self): |
---|
| 102 | super(InterswitchTestsStudents, self).setUp() |
---|
| 103 | |
---|
[13378] | 104 | def test_interswitch_form_pt_school_fees(self): |
---|
| 105 | self.certificate.study_mode = 'ug_pt' |
---|
[12975] | 106 | self.student['studycourse'].entry_session = 2013 |
---|
[13400] | 107 | self.student['studycourse'].certificate.school_fee_1 = 50250.0 |
---|
| 108 | self.app['configuration']['2004'].union_fee = 1000.0 |
---|
| 109 | self.app['configuration']['2004'].welfare_fee = 500.0 |
---|
[11868] | 110 | # Manager can access InterswitchForm |
---|
| 111 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 112 | self.browser.open(self.payments_path) |
---|
| 113 | IWorkflowState(self.student).setState('cleared') |
---|
| 114 | self.student.nationality = u'NG' |
---|
| 115 | self.browser.open(self.payments_path + '/addop') |
---|
[13400] | 116 | self.browser.getControl(name="form.p_category").value = ['schoolfee_incl'] |
---|
[11868] | 117 | self.browser.getControl("Create ticket").click() |
---|
[13381] | 118 | self.assertTrue('ticket created' in self.browser.contents) |
---|
| 119 | ctrl = self.browser.getControl(name='val_id') |
---|
| 120 | self.value = ctrl.options[0] |
---|
| 121 | self.browser.getLink(self.value).click() |
---|
| 122 | self.assertTrue('Amount Authorized' in self.browser.contents) |
---|
[13438] | 123 | # 50250 + 1000 + 500 -500 |
---|
| 124 | self.assertTrue('<span>51250.0</span>' in self.browser.contents) |
---|
[13381] | 125 | self.payment_url = self.browser.url |
---|
| 126 | self.browser.getLink("CollegePAY", index=0).click() |
---|
| 127 | self.assertTrue( |
---|
| 128 | 'Please pay acceptance fee first' in self.browser.contents) |
---|
| 129 | acc_payment = createObject('waeup.StudentOnlinePayment') |
---|
| 130 | acc_payment.p_state = 'paid' |
---|
| 131 | acc_payment.p_category = 'clearance' |
---|
| 132 | self.student['payments']['xyz'] = acc_payment |
---|
| 133 | self.browser.getLink("CollegePAY", index=0).click() |
---|
| 134 | self.assertTrue('<input type="hidden" name="pay_item_id" value="105" />' |
---|
| 135 | in self.browser.contents) |
---|
| 136 | self.assertTrue('Total Amount Authorized:' in self.browser.contents) |
---|
| 137 | self.assertEqual(self.student.current_mode, 'ug_pt') |
---|
| 138 | self.assertTrue( |
---|
[13438] | 139 | '<input type="hidden" name="amount" value="5125000" />' |
---|
[13381] | 140 | in self.browser.contents) |
---|
| 141 | self.assertTrue( |
---|
[13410] | 142 | 'item_name="School Fee Plus" ' |
---|
[13400] | 143 | 'item_amt="4600000" bank_id="7" ' |
---|
[13381] | 144 | 'acct_num="1014847058"' in self.browser.contents) |
---|
| 145 | |
---|
| 146 | def test_interswitch_form_regular_school_fees(self): |
---|
| 147 | self.certificate.study_mode = 'ug_ft' |
---|
| 148 | self.student['studycourse'].entry_session = 2013 |
---|
| 149 | self.student['studycourse'].certificate.school_fee_1 = 51750.0 |
---|
| 150 | # Manager can access InterswitchForm |
---|
| 151 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 152 | self.browser.open(self.payments_path) |
---|
| 153 | IWorkflowState(self.student).setState('cleared') |
---|
| 154 | self.student.nationality = u'NG' |
---|
| 155 | self.browser.open(self.payments_path + '/addop') |
---|
[13421] | 156 | self.browser.getControl(name="form.p_category").value = ['schoolfee_incl'] |
---|
[13381] | 157 | self.browser.getControl("Create ticket").click() |
---|
| 158 | self.assertTrue('ticket created' in |
---|
[11868] | 159 | self.browser.contents) |
---|
| 160 | ctrl = self.browser.getControl(name='val_id') |
---|
| 161 | self.value = ctrl.options[0] |
---|
| 162 | self.browser.getLink(self.value).click() |
---|
[13381] | 163 | self.assertTrue('Amount Authorized' in |
---|
[11868] | 164 | self.browser.contents) |
---|
[13381] | 165 | self.assertTrue('<span>51750.0</span>' in self.browser.contents) |
---|
[11868] | 166 | self.payment_url = self.browser.url |
---|
| 167 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[12975] | 168 | self.assertTrue( |
---|
| 169 | 'Please pay acceptance fee first' in self.browser.contents) |
---|
| 170 | acc_payment = createObject('waeup.StudentOnlinePayment') |
---|
| 171 | acc_payment.p_state = 'paid' |
---|
| 172 | acc_payment.p_category = 'clearance' |
---|
| 173 | self.student['payments']['xyz'] = acc_payment |
---|
| 174 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[13381] | 175 | self.assertTrue('<input type="hidden" name="pay_item_id" value="101" />' |
---|
| 176 | in self.browser.contents) |
---|
| 177 | self.assertTrue('Total Amount Authorized:' |
---|
| 178 | in self.browser.contents) |
---|
| 179 | self.assertEqual(self.student.current_mode, 'ug_ft') |
---|
| 180 | self.assertTrue( |
---|
| 181 | '<input type="hidden" name="amount" value="5175000" />' |
---|
| 182 | in self.browser.contents) |
---|
| 183 | self.assertTrue( |
---|
[13421] | 184 | 'item_name="School Fee Plus" item_amt="4750000" bank_id="117" ' |
---|
[13381] | 185 | 'acct_num="1010827641"' in self.browser.contents) |
---|
[11868] | 186 | |
---|
[12975] | 187 | |
---|
[13378] | 188 | def test_interswitch_form_pt_acceptance_fees(self): |
---|
| 189 | self.certificate.study_mode = 'ug_pt' |
---|
[13400] | 190 | self.app['configuration']['2004'].clearance_fee_pt = 40250.0 |
---|
| 191 | self.app['configuration']['2004'].matric_gown_fee = 2000.0 |
---|
| 192 | self.app['configuration']['2004'].lapel_fee = 800.0 |
---|
[12729] | 193 | # Manager can access InterswitchForm |
---|
| 194 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 195 | self.browser.open(self.payments_path) |
---|
| 196 | IWorkflowState(self.student).setState('admitted') |
---|
| 197 | self.student.nationality = u'NG' |
---|
| 198 | self.browser.open(self.payments_path + '/addop') |
---|
[13400] | 199 | self.browser.getControl(name="form.p_category").value = ['clearance_incl'] |
---|
[12729] | 200 | self.browser.getControl("Create ticket").click() |
---|
[13381] | 201 | self.assertTrue('ticket created' in self.browser.contents) |
---|
[12729] | 202 | ctrl = self.browser.getControl(name='val_id') |
---|
| 203 | self.value = ctrl.options[0] |
---|
| 204 | self.browser.getLink(self.value).click() |
---|
[13381] | 205 | self.assertTrue('Amount Authorized' in self.browser.contents) |
---|
[13438] | 206 | # 40250 + 2000 + 800 - 500 |
---|
| 207 | self.assertTrue('<span>42550.0</span>' in self.browser.contents) |
---|
[12729] | 208 | self.payment_url = self.browser.url |
---|
| 209 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[13381] | 210 | self.assertTrue('<input type="hidden" name="pay_item_id" value="104" />' in |
---|
[12729] | 211 | self.browser.contents) |
---|
[13381] | 212 | self.assertTrue('Total Amount Authorized:' in self.browser.contents) |
---|
| 213 | self.assertTrue( |
---|
[13438] | 214 | '<input type="hidden" name="amount" value="4255000" />' |
---|
[13381] | 215 | in self.browser.contents) |
---|
| 216 | self.assertTrue( |
---|
[13410] | 217 | 'item_name="Acceptance Fee Plus" ' |
---|
[13400] | 218 | 'item_amt="4000000" bank_id="117" ' |
---|
[13381] | 219 | 'acct_num="1014066976"' in self.browser.contents) |
---|
[12729] | 220 | |
---|
[13381] | 221 | def test_interswitch_form_regular_acceptance_fees(self): |
---|
| 222 | self.certificate.study_mode = 'ug_ft' |
---|
| 223 | self.app['configuration']['2004'].clearance_fee = 43050.0 |
---|
| 224 | # Manager can access InterswitchForm |
---|
| 225 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 226 | self.browser.open(self.payments_path) |
---|
| 227 | IWorkflowState(self.student).setState('admitted') |
---|
| 228 | self.student.nationality = u'NG' |
---|
| 229 | self.browser.open(self.payments_path + '/addop') |
---|
[13421] | 230 | self.browser.getControl(name="form.p_category").value = ['clearance_incl'] |
---|
[13381] | 231 | self.browser.getControl("Create ticket").click() |
---|
| 232 | self.assertTrue('ticket created' in self.browser.contents) |
---|
| 233 | ctrl = self.browser.getControl(name='val_id') |
---|
| 234 | self.value = ctrl.options[0] |
---|
| 235 | self.browser.getLink(self.value).click() |
---|
| 236 | self.assertTrue('Amount Authorized' in self.browser.contents) |
---|
| 237 | self.assertTrue('<span>43050.0</span>' in self.browser.contents) |
---|
| 238 | self.payment_url = self.browser.url |
---|
| 239 | self.browser.getLink("CollegePAY", index=0).click() |
---|
| 240 | self.assertTrue('<input type="hidden" name="pay_item_id" value="102" />' |
---|
| 241 | in self.browser.contents) |
---|
| 242 | self.assertTrue('Total Amount Authorized:' in self.browser.contents) |
---|
| 243 | self.assertTrue( |
---|
| 244 | '<input type="hidden" name="amount" value="4305000" />' |
---|
| 245 | in self.browser.contents) |
---|
| 246 | self.assertTrue( |
---|
[13421] | 247 | 'item_name="Acceptance Fee Plus" item_amt="4280000" bank_id="117" ' |
---|
[13381] | 248 | 'acct_num="1010827641"' in self.browser.contents) |
---|
| 249 | |
---|
[13421] | 250 | def test_interswitch_form_concession_fees(self): |
---|
[13381] | 251 | self.certificate.study_mode = 'ug_pt' |
---|
[13421] | 252 | self.app['configuration']['2004'].concession_fee = 1567.0 |
---|
[13381] | 253 | # Manager can access InterswitchForm |
---|
| 254 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 255 | self.browser.open(self.payments_path) |
---|
| 256 | IWorkflowState(self.student).setState('admitted') |
---|
| 257 | self.student.nationality = u'NG' |
---|
| 258 | self.browser.open(self.payments_path + '/addop') |
---|
[13421] | 259 | self.browser.getControl(name="form.p_category").value = ['concessional'] |
---|
[13381] | 260 | self.browser.getControl("Create ticket").click() |
---|
| 261 | self.assertTrue('ticket created' in self.browser.contents) |
---|
| 262 | ctrl = self.browser.getControl(name='val_id') |
---|
| 263 | self.value = ctrl.options[0] |
---|
| 264 | self.browser.getLink(self.value).click() |
---|
| 265 | self.assertTrue('Amount Authorized' in self.browser.contents) |
---|
| 266 | self.assertTrue( |
---|
| 267 | '<span>1567.0</span>' in self.browser.contents) |
---|
| 268 | self.payment_url = self.browser.url |
---|
| 269 | self.certificate.study_mode = 'ug_ft' |
---|
| 270 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[13421] | 271 | self.assertTrue('<input type="hidden" name="pay_item_id" value="107" />' |
---|
[13381] | 272 | in self.browser.contents) |
---|
| 273 | self.assertTrue('Total Amount Authorized:' in self.browser.contents) |
---|
| 274 | self.assertTrue( |
---|
| 275 | '<input type="hidden" name="amount" value="156700" />' |
---|
| 276 | in self.browser.contents) |
---|
| 277 | self.assertTrue( |
---|
[13438] | 278 | 'item_name="Concessional Fee" item_amt="131700" ' |
---|
[13421] | 279 | 'bank_id="117" acct_num="1010835352"' |
---|
[13381] | 280 | in self.browser.contents) |
---|
| 281 | |
---|
[12977] | 282 | def test_interswitch_form_ticket_expired(self): |
---|
[13379] | 283 | self.certificate.study_mode = 'ug_pt' |
---|
[12977] | 284 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 285 | acc_payment = createObject('waeup.StudentOnlinePayment') |
---|
| 286 | acc_payment.p_state = 'unpaid' |
---|
[13408] | 287 | acc_payment.p_session = 2004 |
---|
[12977] | 288 | acc_payment.p_category = 'clearance' |
---|
| 289 | acc_payment.p_id = 'xyz' |
---|
| 290 | acc_payment.pay_item_id = '123' |
---|
| 291 | acc_payment.amount_auth = 876.0 |
---|
| 292 | self.student['payments']['xyz'] = acc_payment |
---|
| 293 | self.browser.open(self.payments_path + '/xyz') |
---|
| 294 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[13381] | 295 | self.assertTrue('<input type="hidden" name="pay_item_id" value="104" />' |
---|
| 296 | in self.browser.contents) |
---|
| 297 | self.assertTrue('Total Amount Authorized:' in self.browser.contents) |
---|
[13379] | 298 | self.assertEqual(self.student.current_mode, 'ug_pt') |
---|
[13381] | 299 | self.assertTrue( |
---|
| 300 | '<input type="hidden" name="amount" value="87600" />' |
---|
| 301 | in self.browser.contents) |
---|
[13017] | 302 | delta = timedelta(days=8) |
---|
[12977] | 303 | acc_payment.creation_date -= delta |
---|
| 304 | self.browser.open(self.payments_path + '/xyz') |
---|
| 305 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[13381] | 306 | self.assertTrue( |
---|
| 307 | 'This payment ticket is too old. Please create a new ticket' |
---|
| 308 | in self.browser.contents) |
---|
[13017] | 309 | delta = timedelta(days=2) |
---|
[12977] | 310 | acc_payment.creation_date += delta |
---|
| 311 | self.browser.open(self.payments_path + '/xyz') |
---|
| 312 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[13381] | 313 | self.assertTrue('Total Amount Authorized:' in self.browser.contents) |
---|
[12977] | 314 | |
---|
[11868] | 315 | @external_test |
---|
| 316 | def test_webservice(self): |
---|
| 317 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 318 | self.browser.open(self.payments_path) |
---|
| 319 | IWorkflowState(self.student).setState('cleared') |
---|
| 320 | self.student.nationality = u'NG' |
---|
| 321 | self.browser.open(self.payments_path + '/addop') |
---|
[13421] | 322 | self.browser.getControl(name="form.p_category").value = ['schoolfee_incl'] |
---|
[11868] | 323 | self.browser.getControl("Create ticket").click() |
---|
[13381] | 324 | self.assertTrue('ticket created' in self.browser.contents) |
---|
[11868] | 325 | ctrl = self.browser.getControl(name='val_id') |
---|
| 326 | self.value = ctrl.options[0] |
---|
| 327 | self.browser.getLink(self.value).click() |
---|
| 328 | self.payment_url = self.browser.url |
---|
[13388] | 329 | # First we have to open InterswitchPageStudent to set provider_amt |
---|
[11868] | 330 | # and gateway_amt |
---|
| 331 | self.browser.open(self.payment_url + '/goto_interswitch') |
---|
| 332 | # Now we can call the webservice |
---|
| 333 | self.browser.open(self.payment_url + '/request_webservice') |
---|
[13381] | 334 | self.assertTrue('Unsuccessful callback' in self.browser.contents) |
---|
[11868] | 335 | # The payment is now in state failed ... |
---|
[13381] | 336 | self.assertTrue('<span>Failed</span>' in self.browser.contents) |
---|
[11868] | 337 | # ... and the catalog has been updated |
---|
| 338 | cat = getUtility(ICatalog, name='payments_catalog') |
---|
| 339 | results = list( |
---|
| 340 | cat.searchResults(p_state=('failed', 'failed'))) |
---|
| 341 | self.assertEqual(len(results), 1) |
---|
| 342 | self.assertEqual(results[0].p_state, 'failed') |
---|
| 343 | |
---|
[13385] | 344 | # Let's replace the p_id with a valid p_id of the AAUE |
---|
[11868] | 345 | # live system. This is definitely not an appropriate |
---|
| 346 | # solution for testing, but we have no choice since |
---|
| 347 | # Interswitch doesn't provide any interface |
---|
| 348 | # for testing. |
---|
| 349 | payment = self.student['payments'][self.value] |
---|
[13385] | 350 | payment.p_id = 'p4465649308559' |
---|
[11868] | 351 | self.browser.open(self.payment_url + '/request_webservice') |
---|
[13388] | 352 | self.assertTrue('Unsuccessful callback: Amount Inconsistency' in |
---|
[11868] | 353 | self.browser.contents) |
---|
| 354 | # The payment is now in state failed ... |
---|
[13381] | 355 | self.assertTrue('<span>Failed</span>' in self.browser.contents) |
---|
[11868] | 356 | # Let's replace the amount autorized with the amount of the |
---|
| 357 | # live system payment |
---|
[13388] | 358 | payment.amount_auth = 60250.0 |
---|
[11868] | 359 | self.browser.open(self.payment_url + '/request_webservice') |
---|
[13381] | 360 | self.assertTrue('Successful payment' in |
---|
[11868] | 361 | self.browser.contents) |
---|
| 362 | # The payment is now in state paid ... |
---|
[13381] | 363 | self.assertTrue('<span>Paid</span>' in self.browser.contents) |
---|
[11868] | 364 | # ... and the catalog has been updated |
---|
| 365 | cat = getUtility(ICatalog, name='payments_catalog') |
---|
| 366 | results = list( |
---|
| 367 | cat.searchResults(p_state=('paid', 'paid'))) |
---|
| 368 | self.assertEqual(len(results), 1) |
---|
| 369 | self.assertEqual(results[0].p_state, 'paid') |
---|
| 370 | # Approval is logged in students.log ... |
---|
| 371 | logfile = os.path.join( |
---|
| 372 | self.app['datacenter'].storage, 'logs', 'students.log') |
---|
| 373 | logcontent = open(logfile).read() |
---|
| 374 | self.assertTrue( |
---|
| 375 | 'zope.mgr - ' |
---|
| 376 | 'waeup.aaue.interswitch.browser.CustomInterswitchPaymentRequestWebservicePageStudent - ' |
---|
[13385] | 377 | 'E1000000 - successful schoolfee payment: p4465649308559\n' |
---|
[11868] | 378 | in logcontent) |
---|
| 379 | # ... and in payments.log |
---|
| 380 | logfile = os.path.join( |
---|
| 381 | self.app['datacenter'].storage, 'logs', 'payments.log') |
---|
| 382 | logcontent = open(logfile).read() |
---|
| 383 | self.assertTrue( |
---|
[13385] | 384 | '"zope.mgr",E1000000,p4465649308559,schoolfee,' |
---|
| 385 | '60250.0,00,1500.0,250.0,0.0,,,\n' |
---|
[11868] | 386 | in logcontent) |
---|