Changeset 8266
- Timestamp:
- 24 Apr 2012, 20:03:01 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py
r8263 r8266 18 18 from hurry.workflow.interfaces import IWorkflowState 19 19 from waeup.kofa.students.tests.test_browser import StudentsFullSetup 20 from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup 21 from waeup.kofa.configuration import SessionConfiguration 20 22 from waeup.uniben.testing import FunctionalLayer 21 23 … … 36 38 37 39 38 class InterswitchTests (StudentsFullSetup):40 class InterswitchTestsStudents(StudentsFullSetup): 39 41 """Tests for the Interswitch payment gateway. 40 42 """ … … 43 45 44 46 def setUp(self): 45 super(InterswitchTests , self).setUp()47 super(InterswitchTestsStudents, self).setUp() 46 48 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 47 49 self.browser.open(self.payments_path) … … 56 58 self.assertMatches('...Amount Authorized...', 57 59 self.browser.contents) 60 self.assertMatches( 61 '...<span>40000.0</span>...', 62 self.browser.contents) 58 63 self.payment_url = self.browser.url 59 64 … … 76 81 self.assertMatches('...Total Amount Authorized:...', 77 82 self.browser.contents) 83 # The total amount to be processed by Interswitch 84 # has been reduced by the Interswitch fee of 150 Nairas 78 85 self.assertMatches( 79 86 '...<input type="hidden" name="amount" value="3985000.0" />...', … … 107 114 self.assertMatches('...Unsuccessful callback...', 108 115 self.browser.contents) 116 # The payment is now in state failed 117 self.assertMatches('...<span>Failed</span>...', 118 self.browser.contents) 119 120 class InterswitchTestsApplicants(ApplicantsFullSetup): 121 """Tests for the Interswitch payment gateway. 122 """ 123 124 layer = FunctionalLayer 125 126 def setUp(self): 127 super(InterswitchTestsApplicants, self).setUp() 128 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 129 self.browser.open(self.manage_path) 130 #IWorkflowState(self.student).setState('started') 131 super(InterswitchTestsApplicants, self).fill_correct_values() 132 self.browser.getControl(name="transition").value = ['start'] 133 self.browser.getControl("Save").click() 134 self.browser.getControl("Add online").click() 135 self.assertTrue( 136 'Session configuration object is not available' 137 in self.browser.contents) 138 configuration = SessionConfiguration() 139 configuration.academic_session = 2009 140 configuration.application_fee = 1000.0 141 self.app['configuration'].addSessionConfiguration(configuration) 142 self.browser.getControl("Add online").click() 143 self.assertMatches('...ticket created...', 144 self.browser.contents) 145 ctrl = self.browser.getControl(name='val_id') 146 value = ctrl.options[0] 147 self.browser.getLink(value).click() 148 self.assertMatches('...Amount Authorized...', 149 self.browser.contents) 150 self.assertMatches( 151 '...<span>1000.0</span>...', 152 self.browser.contents) 153 self.payment_url = self.browser.url 154 155 156 def test_interswitch_form(self): 157 158 # Manager can access InterswitchForm 159 self.browser.getLink("CollegePAY", index=0).click() 160 self.assertMatches('...Total Amount Authorized:...', 161 self.browser.contents) 162 # The total amount to be processed by Interswitch 163 # has been reduced by the Interswitch fee of 150 Nairas 164 self.assertMatches( 165 '...<input type="hidden" name="amount" value="85000.0" />...', 166 self.browser.contents) 167 168 @external_test 169 def test_webservice(self): 170 171 self.browser.open(self.payment_url + '/request_webservice') 172 self.assertMatches('...Unsuccessful callback...', 173 self.browser.contents) 174 # The payment is now in state failed 175 self.assertMatches('...<span>Failed</span>...', 176 self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.