Changeset 13386 for main/kofacustom.nigeria/trunk/src/kofacustom/nigeria
- Timestamp:
- 4 Nov 2015, 05:10:46 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/tests.py
r13015 r13386 24 24 from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup 25 25 from waeup.kofa.configuration import SessionConfiguration 26 from waeup.kofa.students.payments import StudentOnlinePayment 27 from kofacustom.nigeria.interswitch.helpers import query_interswitch 26 28 from kofacustom.nigeria.testing import FunctionalLayer 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 = True 34 35 def external_test(func): 36 if not EXTERNAL_TESTS: 37 myself = __file__ 38 if myself.endswith('.pyc'): 39 myself = myself[:-2] 40 print "WARNING: external tests are skipped!" 41 print "WARNING: edit %s to enable them." % myself 42 return 43 return func 27 44 28 45 class InterswitchTestsStudents(StudentsFullSetup): … … 48 65 self.assertMatches('...Amount Authorized...', 49 66 self.browser.contents) 50 self.assertMatches( 51 '...<span>40000.0</span>...', 52 self.browser.contents) 67 self.assertTrue('<span>40000.0</span>', self.browser.contents) 53 68 self.payment_url = self.browser.url 54 69 self.payment = self.student['payments'][self.value] … … 119 134 self.assertMatches('...Total Amount Authorized:...', 120 135 self.browser.contents) 136 137 @external_test 138 def test_query_interswitch(self): 139 host = 'webpay.interswitchng.com' 140 url = '/paydirect/services/TransactionQueryWs.asmx' 141 https = True 142 product_id = '5845' # AAUE regular 143 payment = StudentOnlinePayment() 144 payment.p_id ='p4465649308559' 145 payment.amount_auth = 60250.0 146 success, msg, log = query_interswitch( 147 payment, product_id, host, url, https) 148 self.assertEqual('Successful callback received', msg) 149 self.assertTrue(success) 150 self.assertTrue( 151 '00:Approved Successful:6025000:3154:p4465649308559:' 152 'ZIB|WEB|ABAL|3-11-2015|021336:000457580882' in log) 121 153 122 154 class InterswitchTestsApplicants(ApplicantsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.