[10765] | 1 | ## $Id: tests.py 15345 2019-03-06 21:33:16Z henrik $ |
---|
| 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 |
---|
[11271] | 19 | from datetime import datetime, date, timedelta |
---|
[10765] | 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 |
---|
[14889] | 26 | from waeup.kofa.university.faculty import Faculty |
---|
| 27 | from waeup.kofa.university.department import Department |
---|
[14716] | 28 | from kofacustom.dspg.testing import FunctionalLayer |
---|
[10765] | 29 | |
---|
| 30 | # Also run tests that send requests to external servers? |
---|
| 31 | # If you enable this, please make sure the external services |
---|
| 32 | # do exist really and are not bothered by being spammed by a test programme. |
---|
| 33 | EXTERNAL_TESTS = False |
---|
| 34 | |
---|
[14732] | 35 | SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg') |
---|
| 36 | |
---|
[10765] | 37 | def external_test(func): |
---|
| 38 | if not EXTERNAL_TESTS: |
---|
| 39 | myself = __file__ |
---|
| 40 | if myself.endswith('.pyc'): |
---|
| 41 | myself = myself[:-2] |
---|
| 42 | print "WARNING: external tests are skipped!" |
---|
| 43 | print "WARNING: edit %s to enable them." % myself |
---|
| 44 | return |
---|
| 45 | return func |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | class InterswitchTestsStudents(StudentsFullSetup): |
---|
| 49 | """Tests for the Interswitch payment gateway. |
---|
| 50 | """ |
---|
| 51 | |
---|
| 52 | layer = FunctionalLayer |
---|
| 53 | |
---|
| 54 | def setUp(self): |
---|
| 55 | super(InterswitchTestsStudents, self).setUp() |
---|
| 56 | |
---|
| 57 | def test_interswitch_form(self): |
---|
| 58 | # Manager can access InterswitchForm |
---|
| 59 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 60 | self.browser.open(self.payments_path) |
---|
| 61 | IWorkflowState(self.student).setState('cleared') |
---|
| 62 | self.student.nationality = u'NG' |
---|
[14875] | 63 | # ND FT Non-Deltan Fresh Student School Fee |
---|
| 64 | self.certificate.study_mode = 'nd_ft' |
---|
| 65 | self.certificate.school_fee_3 = 30000.0 |
---|
[10765] | 66 | self.browser.open(self.payments_path + '/addop') |
---|
| 67 | self.browser.getControl(name="form.p_category").value = ['schoolfee'] |
---|
| 68 | self.browser.getControl("Create ticket").click() |
---|
[14938] | 69 | self.assertTrue('You have to pay NADESU/SA/SUG Dues first' |
---|
| 70 | in self.browser.contents) |
---|
| 71 | payment = createObject('waeup.StudentOnlinePayment') |
---|
| 72 | payment.p_category = u'dep_sug' |
---|
| 73 | payment.p_session = self.student.current_session |
---|
| 74 | payment.p_id = u'anyid' |
---|
| 75 | payment.p_state = u'paid' |
---|
| 76 | self.student['payments']['anykey'] = payment |
---|
| 77 | self.browser.open(self.payments_path + '/addop') |
---|
| 78 | self.browser.getControl(name="form.p_category").value = ['schoolfee'] |
---|
| 79 | self.browser.getControl("Create ticket").click() |
---|
[10765] | 80 | self.assertMatches('...ticket created...', |
---|
| 81 | self.browser.contents) |
---|
| 82 | ctrl = self.browser.getControl(name='val_id') |
---|
[14938] | 83 | self.value = ctrl.options[1] |
---|
[10765] | 84 | self.browser.getLink(self.value).click() |
---|
[14889] | 85 | self.assertTrue('<span>30000.0</span>' in self.browser.contents) |
---|
[10765] | 86 | self.payment_url = self.browser.url |
---|
| 87 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[14875] | 88 | self.assertTrue('<input type="hidden" name="pay_item_id" value="102" />' |
---|
| 89 | in self.browser.contents) |
---|
| 90 | self.assertTrue( |
---|
| 91 | '<input type="hidden" name="amount" value="3000000" />' in |
---|
| 92 | self.browser.contents) |
---|
| 93 | self.assertTrue( |
---|
[15215] | 94 | 'item_name="School Fee" item_amt="2575000" bank_id="117" acct_num="1012808851"' in |
---|
[14875] | 95 | self.browser.contents) |
---|
| 96 | # ND FT Non-Deltan Fresh Student Acceptance Fee |
---|
| 97 | self.app['configuration']['2004'].clearance_fee = 12345.0 |
---|
| 98 | self.browser.open(self.payments_path + '/addop') |
---|
| 99 | self.browser.getControl(name="form.p_category").value = ['clearance'] |
---|
| 100 | self.browser.getControl("Create ticket").click() |
---|
[14938] | 101 | self.assertTrue('ticket created' in self.browser.contents) |
---|
[14875] | 102 | ctrl = self.browser.getControl(name='val_id') |
---|
[14938] | 103 | self.value = ctrl.options[2] |
---|
[14875] | 104 | self.browser.getLink(self.value).click() |
---|
[14938] | 105 | self.assertTrue('Amount Authorized' in self.browser.contents) |
---|
| 106 | self.assertTrue('<span>12345.0</span>' in self.browser.contents) |
---|
[14875] | 107 | self.payment_url = self.browser.url |
---|
| 108 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[14938] | 109 | self.assertTrue('<input type="hidden" name="pay_item_id" value="103" />' |
---|
| 110 | in self.browser.contents) |
---|
[14875] | 111 | self.assertTrue( |
---|
| 112 | '<input type="hidden" name="amount" value="1234500" />' in |
---|
[10765] | 113 | self.browser.contents) |
---|
[14875] | 114 | self.assertTrue( |
---|
[15179] | 115 | 'item_name="Acceptance" item_amt="1159500" bank_id="51" acct_num="5210039869"' in |
---|
[14875] | 116 | self.browser.contents) |
---|
[10765] | 117 | |
---|
[12979] | 118 | def test_interswitch_form_ticket_expired(self): |
---|
| 119 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 120 | acc_payment = createObject('waeup.StudentOnlinePayment') |
---|
| 121 | acc_payment.p_state = 'unpaid' |
---|
| 122 | acc_payment.p_category = 'clearance' |
---|
| 123 | acc_payment.p_id = 'xyz' |
---|
| 124 | acc_payment.pay_item_id = '123' |
---|
| 125 | acc_payment.amount_auth = 876.0 |
---|
| 126 | self.student['payments']['xyz'] = acc_payment |
---|
| 127 | self.browser.open(self.payments_path + '/xyz') |
---|
| 128 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[14862] | 129 | self.assertMatches('...<input type="hidden" name="pay_item_id" value="103" />...', |
---|
[12979] | 130 | self.browser.contents) |
---|
| 131 | self.assertMatches('...Total Amount Authorized:...', |
---|
| 132 | self.browser.contents) |
---|
| 133 | self.assertEqual(self.student.current_mode, 'ug_ft') |
---|
| 134 | self.assertMatches( |
---|
| 135 | '...<input type="hidden" name="amount" value="87600" />...', |
---|
| 136 | self.browser.contents) |
---|
[13020] | 137 | delta = timedelta(days=8) |
---|
[12979] | 138 | acc_payment.creation_date -= delta |
---|
| 139 | self.browser.open(self.payments_path + '/xyz') |
---|
| 140 | self.browser.getLink("CollegePAY", index=0).click() |
---|
| 141 | self.assertMatches( |
---|
| 142 | '...This payment ticket is too old. Please create a new ticket...', |
---|
| 143 | self.browser.contents) |
---|
[13020] | 144 | delta = timedelta(days=2) |
---|
[12979] | 145 | acc_payment.creation_date += delta |
---|
| 146 | self.browser.open(self.payments_path + '/xyz') |
---|
| 147 | self.browser.getLink("CollegePAY", index=0).click() |
---|
| 148 | self.assertMatches('...Total Amount Authorized:...', |
---|
| 149 | self.browser.contents) |
---|
| 150 | |
---|
[14938] | 151 | def test_pt_payments(self): |
---|
[14889] | 152 | # Add SPAT certificate |
---|
| 153 | certificate = createObject('waeup.Certificate') |
---|
| 154 | certificate.code = u'CERT2' |
---|
| 155 | certificate.application_category = 'basic' # can be anything |
---|
| 156 | certificate.start_level = 100 |
---|
| 157 | certificate.end_level = 500 |
---|
| 158 | certificate.study_mode = u'ug_ft' # can be anything |
---|
| 159 | self.app['faculties']['SPAT'] = Faculty(code=u'SPAT') |
---|
| 160 | self.app['faculties']['SPAT']['dep2'] = Department(code=u'dep2') |
---|
| 161 | department = self.app['faculties']['SPAT']['dep2'] |
---|
| 162 | self.app['faculties']['SPAT']['dep2'].certificates.addCertificate( |
---|
| 163 | certificate) |
---|
| 164 | certificate.school_fee_3 = 30000.0 |
---|
| 165 | self.student['studycourse'].certificate = certificate |
---|
| 166 | # Manager can access InterswitchForm |
---|
| 167 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 168 | self.browser.open(self.payments_path) |
---|
| 169 | IWorkflowState(self.student).setState('cleared') |
---|
| 170 | self.student.nationality = u'NG' |
---|
| 171 | # ND PT Non-Deltan Fresh Student School Fee |
---|
| 172 | self.certificate.study_mode = 'nd_ft' |
---|
| 173 | self.certificate.school_fee_3 = 30000.0 |
---|
[14940] | 174 | # dep_sug tickets cannot be created |
---|
[14889] | 175 | self.browser.open(self.payments_path + '/addop') |
---|
[14938] | 176 | self.browser.getControl(name="form.p_category").value = ['dep_sug'] |
---|
| 177 | self.browser.getControl("Create ticket").click() |
---|
[14940] | 178 | self.assertTrue('Amount could not be determined' in self.browser.contents) |
---|
| 179 | #self.assertTrue('ticket created' in self.browser.contents) |
---|
| 180 | #ctrl = self.browser.getControl(name='val_id') |
---|
| 181 | #dep_sug_pid = ctrl.options[0] |
---|
| 182 | #self.assertTrue(self.student['payments'][dep_sug_pid].amount_auth == 1650) |
---|
| 183 | #self.browser.getLink(dep_sug_pid).click() |
---|
| 184 | #self.browser.getLink("CollegePAY", index=0).click() |
---|
| 185 | #self.student['payments'][dep_sug_pid].p_state = 'paid' |
---|
| 186 | #self.assertTrue( |
---|
| 187 | # '<item_detail item_id="1" item_name="Students Welfare" ' |
---|
| 188 | # 'item_amt="50000" bank_id="11" acct_num="0037892949" />' |
---|
| 189 | # in self.browser.contents) |
---|
[14938] | 190 | # Add school fee ticket |
---|
| 191 | self.browser.open(self.payments_path + '/addop') |
---|
[14889] | 192 | self.browser.getControl(name="form.p_category").value = ['schoolfee'] |
---|
| 193 | self.browser.getControl("Create ticket").click() |
---|
| 194 | self.assertMatches('...ticket created...', self.browser.contents) |
---|
| 195 | ctrl = self.browser.getControl(name='val_id') |
---|
[14940] | 196 | self.value = ctrl.options[0] |
---|
[14889] | 197 | self.browser.getLink(self.value).click() |
---|
| 198 | self.assertTrue('<span>30000.0</span>' in self.browser.contents) |
---|
| 199 | self.payment_url = self.browser.url |
---|
| 200 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[15215] | 201 | self.assertTrue('<item_detail item_id="1" item_name="School Fee 1" item_amt="1545000" bank_id="117" acct_num="1015220292" />' |
---|
[14889] | 202 | in self.browser.contents) |
---|
[14961] | 203 | self.assertTrue('<item_detail item_id="2" item_name="School Fee 2" item_amt="1030000" bank_id="123" acct_num="1002883141" />' |
---|
[14889] | 204 | in self.browser.contents) |
---|
[15255] | 205 | self.assertTrue('<item_detail item_id="3" item_name="WAEAC" item_amt="280000" bank_id="8" acct_num="2028964403" />' |
---|
[14889] | 206 | in self.browser.contents) |
---|
[15345] | 207 | self.assertTrue('<item_detail item_id="4" item_name="Technology Fee" item_amt="120000" bank_id="10" acct_num="0032256360" />' |
---|
[14964] | 208 | in self.browser.contents) |
---|
[14889] | 209 | |
---|
[14921] | 210 | def test_interswitch_form_dep_sug_payments(self): |
---|
| 211 | # Manager can access InterswitchForm |
---|
| 212 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 213 | self.browser.open(self.payments_path) |
---|
| 214 | IWorkflowState(self.student).setState('cleared') |
---|
| 215 | self.browser.open(self.payments_path + '/addop') |
---|
| 216 | self.browser.getControl(name="form.p_category").value = ['dep_sug'] |
---|
| 217 | self.browser.getControl("Create ticket").click() |
---|
| 218 | self.assertMatches('...ticket created...', self.browser.contents) |
---|
| 219 | ctrl = self.browser.getControl(name='val_id') |
---|
| 220 | self.value = ctrl.options[0] |
---|
| 221 | self.browser.getLink(self.value).click() |
---|
[14938] | 222 | self.assertTrue('<span>3150.0</span>' in self.browser.contents) |
---|
[14921] | 223 | self.payment_url = self.browser.url |
---|
| 224 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[14938] | 225 | self.assertTrue('<item_detail item_id="1" item_name="SUG" item_amt="100000" bank_id="11" acct_num="0038079930" />' |
---|
[14921] | 226 | in self.browser.contents) |
---|
| 227 | self.assertTrue('<item_detail item_id="2" item_name="Students Welfare" item_amt="50000" bank_id="11" acct_num="0037892949" />' |
---|
| 228 | in self.browser.contents) |
---|
| 229 | self.assertTrue('<item_detail item_id="3" item_name="Anti-Cult Book" item_amt="90000" bank_id="11" acct_num="0037892949" />' |
---|
| 230 | in self.browser.contents) |
---|
[14938] | 231 | self.assertTrue('<item_detail item_id="4" item_name="NADESSTU" item_amt="50000" bank_id="11" acct_num="0036375968" />' |
---|
[14921] | 232 | in self.browser.contents) |
---|
| 233 | |
---|
[10765] | 234 | @external_test |
---|
| 235 | def test_webservice(self): |
---|
| 236 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 237 | self.browser.open(self.payments_path) |
---|
| 238 | IWorkflowState(self.student).setState('cleared') |
---|
| 239 | self.student.nationality = u'NG' |
---|
| 240 | self.browser.open(self.payments_path + '/addop') |
---|
| 241 | self.browser.getControl(name="form.p_category").value = ['schoolfee'] |
---|
| 242 | self.browser.getControl("Create ticket").click() |
---|
| 243 | self.assertMatches('...ticket created...', |
---|
| 244 | self.browser.contents) |
---|
| 245 | ctrl = self.browser.getControl(name='val_id') |
---|
| 246 | self.value = ctrl.options[0] |
---|
| 247 | self.browser.getLink(self.value).click() |
---|
| 248 | self.payment_url = self.browser.url |
---|
| 249 | # First we have open InterswitchPageStudent to set provider_amt |
---|
| 250 | # and gateway_amt |
---|
| 251 | self.browser.open(self.payment_url + '/goto_interswitch') |
---|
| 252 | # Now we can call the webservice |
---|
| 253 | self.browser.open(self.payment_url + '/request_webservice') |
---|
| 254 | self.assertMatches('...Unsuccessful callback...', |
---|
| 255 | self.browser.contents) |
---|
| 256 | # The payment is now in state failed ... |
---|
| 257 | self.assertMatches('...<span>Failed</span>...', |
---|
| 258 | self.browser.contents) |
---|
| 259 | # ... and the catalog has been updated |
---|
| 260 | cat = getUtility(ICatalog, name='payments_catalog') |
---|
| 261 | results = list( |
---|
| 262 | cat.searchResults(p_state=('failed', 'failed'))) |
---|
| 263 | self.assertEqual(len(results), 1) |
---|
| 264 | self.assertEqual(results[0].p_state, 'failed') |
---|
| 265 | |
---|
| 266 | # Let's replace the p_id with a valid p_id of the Uniben |
---|
| 267 | # live system. This is definitely not an appropriate |
---|
| 268 | # solution for testing, but we have no choice since |
---|
| 269 | # Interswitch doesn't provide any interface |
---|
| 270 | # for testing. |
---|
| 271 | payment = self.student['payments'][self.value] |
---|
| 272 | payment.p_id = 'p3547789850240' |
---|
| 273 | self.browser.open(self.payment_url + '/request_webservice') |
---|
| 274 | self.assertMatches('...Callback amount does not match...', |
---|
| 275 | self.browser.contents) |
---|
| 276 | # The payment is now in state failed ... |
---|
| 277 | self.assertMatches('...<span>Failed</span>...', |
---|
| 278 | self.browser.contents) |
---|
| 279 | # Let's replace the amount autorized with the amount of the |
---|
| 280 | # live system payment |
---|
| 281 | payment.amount_auth = payment.r_amount_approved |
---|
| 282 | self.browser.open(self.payment_url + '/request_webservice') |
---|
| 283 | self.assertMatches('...Successful payment...', |
---|
| 284 | self.browser.contents) |
---|
| 285 | # The payment is now in state paid ... |
---|
| 286 | self.assertMatches('...<span>Paid</span>...', |
---|
| 287 | self.browser.contents) |
---|
| 288 | # ... and the catalog has been updated |
---|
| 289 | cat = getUtility(ICatalog, name='payments_catalog') |
---|
| 290 | results = list( |
---|
| 291 | cat.searchResults(p_state=('paid', 'paid'))) |
---|
| 292 | self.assertEqual(len(results), 1) |
---|
| 293 | self.assertEqual(results[0].p_state, 'paid') |
---|
| 294 | # Approval is logged in students.log ... |
---|
| 295 | logfile = os.path.join( |
---|
| 296 | self.app['datacenter'].storage, 'logs', 'students.log') |
---|
| 297 | logcontent = open(logfile).read() |
---|
| 298 | self.assertTrue( |
---|
| 299 | 'zope.mgr - ' |
---|
[14716] | 300 | 'kofacustom.dspg.interswitch.browser.CustomInterswitchPaymentRequestWebservicePageStudent - ' |
---|
[10765] | 301 | 'X1000000 - successful schoolfee payment: p3547789850240\n' |
---|
| 302 | in logcontent) |
---|
| 303 | # ... and in payments.log |
---|
| 304 | logfile = os.path.join( |
---|
| 305 | self.app['datacenter'].storage, 'logs', 'payments.log') |
---|
| 306 | logcontent = open(logfile).read() |
---|
| 307 | self.assertTrue( |
---|
| 308 | '"zope.mgr",X1000000,p3547789850240,schoolfee,' |
---|
| 309 | '12000.0,00,0.0,150.0,0.0,,,\n' |
---|
| 310 | in logcontent) |
---|
| 311 | |
---|
| 312 | |
---|
| 313 | class InterswitchTestsApplicants(ApplicantsFullSetup): |
---|
| 314 | """Tests for the Interswitch payment gateway. |
---|
| 315 | """ |
---|
| 316 | |
---|
| 317 | layer = FunctionalLayer |
---|
| 318 | |
---|
| 319 | def setUp(self): |
---|
| 320 | super(InterswitchTestsApplicants, self).setUp() |
---|
[11271] | 321 | configuration = SessionConfiguration() |
---|
| 322 | configuration.academic_session = datetime.now().year - 2 |
---|
| 323 | self.app['configuration'].addSessionConfiguration(configuration) |
---|
| 324 | self.configuration = configuration |
---|
[10765] | 325 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
| 326 | self.browser.open(self.manage_path) |
---|
| 327 | #IWorkflowState(self.student).setState('started') |
---|
| 328 | super(InterswitchTestsApplicants, self).fill_correct_values() |
---|
| 329 | self.applicantscontainer.application_fee = 1000.0 |
---|
| 330 | self.browser.getControl(name="form.nationality").value = ['NG'] |
---|
| 331 | self.browser.getControl(name="transition").value = ['start'] |
---|
| 332 | self.browser.getControl("Save").click() |
---|
[14889] | 333 | |
---|
| 334 | |
---|
| 335 | def test_interswitch_form(self): |
---|
[10765] | 336 | self.browser.getControl("Add online").click() |
---|
[14732] | 337 | self.assertMatches('...passport photo before making payment...', |
---|
| 338 | self.browser.contents) |
---|
| 339 | self.browser.open(self.manage_path) |
---|
| 340 | super(InterswitchTestsApplicants, self).fill_correct_values() |
---|
| 341 | self.browser.getControl(name="form.nationality").value = ['NG'] |
---|
| 342 | #self.browser.getControl(name="transition").value = ['start'] |
---|
| 343 | image = open(SAMPLE_IMAGE, 'rb') |
---|
| 344 | ctrl = self.browser.getControl(name='form.passport') |
---|
| 345 | file_ctrl = ctrl.mech_control |
---|
| 346 | file_ctrl.add_file(image, filename='myphoto.jpg') |
---|
| 347 | self.browser.getControl("Save").click() |
---|
| 348 | self.browser.getControl("Add online").click() |
---|
[10765] | 349 | self.assertMatches('...ticket created...', |
---|
| 350 | self.browser.contents) |
---|
| 351 | #ctrl = self.browser.getControl(name='val_id') |
---|
| 352 | #value = ctrl.options[0] |
---|
| 353 | #self.browser.getLink(value).click() |
---|
| 354 | self.assertMatches('...Amount Authorized...', |
---|
| 355 | self.browser.contents) |
---|
[14889] | 356 | self.assertTrue('span>1000.0</span>' in self.browser.contents) |
---|
[10765] | 357 | self.payment_url = self.browser.url |
---|
| 358 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[14889] | 359 | self.assertTrue('<input type="hidden" name="amount" value="100000" />' |
---|
| 360 | in self.browser.contents) |
---|
[13020] | 361 | delta = timedelta(days=8) |
---|
[12979] | 362 | self.applicant.values()[0].creation_date -= delta |
---|
| 363 | self.browser.open(self.payment_url) |
---|
| 364 | self.browser.getLink("CollegePAY", index=0).click() |
---|
| 365 | self.assertMatches( |
---|
| 366 | '...This payment ticket is too old. Please create a new ticket...', |
---|
| 367 | self.browser.contents) |
---|
[14889] | 368 | # ND PT Application Fee |
---|
| 369 | self.applicantscontainer.application_category = 'ndpt' |
---|
| 370 | self.certificate.application_category = 'ndpt' |
---|
| 371 | self.browser.open(self.manage_path) |
---|
| 372 | self.browser.getControl("Add online").click() |
---|
| 373 | self.browser.getLink("CollegePAY", index=0).click() |
---|
[15098] | 374 | self.assertTrue('<item_detail item_id="1" item_name="Application 1" item_amt="15000" bank_id="117" acct_num="1015220292" />' |
---|
[14889] | 375 | in self.browser.contents) |
---|
| 376 | self.assertTrue('<item_detail item_id="2" item_name="Application 2" item_amt="10000" bank_id="123" acct_num="1002883141" />' |
---|
| 377 | in self.browser.contents) |
---|
[15255] | 378 | self.assertTrue('<item_detail item_id="3" item_name="WAEAC" item_amt="50000" bank_id="8" acct_num="2028964403" />' |
---|
[14889] | 379 | in self.browser.contents) |
---|
[10765] | 380 | |
---|
| 381 | @external_test |
---|
| 382 | def test_webservice(self): |
---|
| 383 | |
---|
| 384 | self.browser.open(self.payment_url + '/request_webservice') |
---|
| 385 | self.assertMatches('...Unsuccessful callback...', |
---|
| 386 | self.browser.contents) |
---|
| 387 | # The payment is now in state failed |
---|
| 388 | self.assertMatches('...<span>Failed</span>...', |
---|
| 389 | self.browser.contents) |
---|