Changeset 8526 for main/waeup.uniben/trunk/src/waeup/uniben/applicants
- Timestamp:
- 26 May 2012, 10:43:09 (12 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py
r8519 r8526 153 153 factory = u'waeup.CustomApplicantOnlinePayment' 154 154 155 def _fillCustomFields(self, payment, session_config):156 # No custom fields at the moment157 return payment158 159 155 class CustomExportPDFPaymentSlipPage(ExportPDFPaymentSlipPage): 160 156 """Deliver a PDF slip of the context. -
main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests.py
r8519 r8526 30 30 from waeup.kofa.university.department import Department 31 31 from waeup.kofa.testing import FunctionalTestCase 32 from waeup.kofa.configuration import SessionConfiguration 32 33 from waeup.kofa.applicants.container import ApplicantsContainer 33 34 from waeup.kofa.applicants.tests.test_batching import ApplicantImportExportSetup … … 63 64 self.pgcontainer.code = u'pgft2011' 64 65 self.pgcontainer.prefix = u'pgft' 66 self.pgcontainer.year = 2011 67 self.pgcontainer.application_fee = 300.0 68 self.pgcontainer.title = u'This is the pgft2011 container' 65 69 self.app['applicants']['pgft2011'] = self.pgcontainer 66 70 self.ugcontainer = ApplicantsContainer() 67 self.ugcontainer.code = u'app2011' 68 self.ugcontainer.prefix = u'app' 71 self.ugcontainer.code = u'putme2011' 72 self.ugcontainer.prefix = u'putme' 73 self.ugcontainer.year = 2011 74 self.ugcontainer.application_fee = 200.0 75 self.ugcontainer.title = u'This is the app2011 container' 69 76 self.app['applicants']['app2011'] = self.ugcontainer 70 77 … … 96 103 self.ugapplicant = self.app['applicants']['app2011'][ 97 104 self.ugapplication_number] 105 self.pgapplicant_path = ('http://localhost/app/applicants/pgft2011/%s' 106 % self.pgapplication_number) 107 self.ugapplicant_path = ('http://localhost/app/applicants/app2011/%s' 108 % self.ugapplication_number) 98 109 99 110 self.browser = Browser() … … 106 117 return 107 118 108 def test_manage_and_view_applicant(self): 109 # Managers can manage pg applicants 110 pgapplicant_path = ('http://localhost/app/applicants/pgft2011/%s' 111 % self.pgapplication_number) 112 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 113 # The IPGApplicant interface is really used in all pages 114 self.browser.open(pgapplicant_path) 115 self.assertEqual(self.browser.headers['Status'], '200 Ok') 116 self.assertTrue('Employer' in self.browser.contents) 117 self.browser.open(pgapplicant_path + '/manage') 118 self.assertEqual(self.browser.headers['Status'], '200 Ok') 119 self.assertTrue('Employer' in self.browser.contents) 120 self.browser.open(pgapplicant_path + '/edit') 121 self.assertEqual(self.browser.headers['Status'], '200 Ok') 122 self.assertTrue('Employer' in self.browser.contents) 123 self.browser.open(pgapplicant_path + '/application_slip.pdf') 124 self.assertEqual(self.browser.headers['Status'], '200 Ok') 125 # If we view the applicant in the ug container, 126 # the employer field doesn't appear 127 ugapplicant_path = ('http://localhost/app/applicants/app2011/%s' 128 % self.ugapplication_number) 129 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 130 self.browser.open(ugapplicant_path) 131 self.assertEqual(self.browser.headers['Status'], '200 Ok') 132 self.assertFalse('Employer' in self.browser.contents) 133 self.browser.open(ugapplicant_path + '/manage') 134 self.assertEqual(self.browser.headers['Status'], '200 Ok') 135 # We can save the applicant 119 def fill_correct_values(self): 136 120 self.browser.getControl(name="form.reg_number").value = '1234' 137 121 self.browser.getControl(name="form.firstname").value = 'John' … … 142 126 self.browser.getControl(name="form.sex").value = ['m'] 143 127 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 128 129 def test_manage_and_view_applicant(self): 130 # Managers can manage pg applicants 131 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 132 # The IPGApplicant interface is really used in all pages 133 self.browser.open(self.pgapplicant_path) 134 self.assertEqual(self.browser.headers['Status'], '200 Ok') 135 self.assertTrue('Employer' in self.browser.contents) 136 self.browser.open(self.pgapplicant_path + '/manage') 137 self.assertEqual(self.browser.headers['Status'], '200 Ok') 138 self.assertTrue('Employer' in self.browser.contents) 139 self.browser.open(self.pgapplicant_path + '/edit') 140 self.assertEqual(self.browser.headers['Status'], '200 Ok') 141 self.assertTrue('Employer' in self.browser.contents) 142 self.browser.open(self.pgapplicant_path + '/application_slip.pdf') 143 self.assertEqual(self.browser.headers['Status'], '200 Ok') 144 # If we view the applicant in the ug container, 145 # the employer field doesn't appear 146 self.browser.open(self.ugapplicant_path) 147 self.assertEqual(self.browser.headers['Status'], '200 Ok') 148 self.assertFalse('Employer' in self.browser.contents) 149 self.browser.open(self.ugapplicant_path + '/manage') 150 self.assertEqual(self.browser.headers['Status'], '200 Ok') 151 # We can save the applicant 152 self.fill_correct_values() 144 153 self.browser.getControl("Save").click() 145 154 self.assertMatches('...Form has been saved...', self.browser.contents) 146 155 self.assertFalse('Employer' in self.browser.contents) 147 self.browser.open( ugapplicant_path + '/edit')156 self.browser.open(self.ugapplicant_path + '/edit') 148 157 self.assertEqual(self.browser.headers['Status'], '200 Ok') 149 158 self.assertFalse('Employer' in self.browser.contents) 150 self.browser.open(ugapplicant_path + '/application_slip.pdf') 151 self.assertEqual(self.browser.headers['Status'], '200 Ok') 159 self.browser.open(self.ugapplicant_path + '/application_slip.pdf') 160 self.assertEqual(self.browser.headers['Status'], '200 Ok') 161 return 162 163 def test_application_payment(self): 164 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 165 166 # UG (UTME) applicant 167 self.browser.open(self.ugapplicant_path) 168 self.browser.open(self.ugapplicant_path + '/manage') 169 self.assertEqual(self.browser.headers['Status'], '200 Ok') 170 self.fill_correct_values() 171 self.browser.getControl("Save").click() 172 self.assertMatches('...Form has been saved...', self.browser.contents) 173 self.fill_correct_values() 174 self.browser.getControl("Save").click() 175 self.browser.getControl("Add online payment ticket").click() 176 self.assertMatches('...Payment ticket created...', 177 self.browser.contents) 178 self.assertMatches('...Amount Authorized...', 179 self.browser.contents) 180 payment_id = self.ugapplicant.keys()[0] 181 payment = self.ugapplicant[payment_id] 182 self.assertEqual(payment.p_item,'This is the app2011 container') 183 self.assertEqual(payment.p_session,2011) 184 self.assertEqual(payment.p_category,'application') 185 self.assertEqual(payment.amount_auth, 200.0) 186 187 # PG applicants pay more 188 self.browser.open(self.pgapplicant_path) 189 self.browser.open(self.pgapplicant_path + '/manage') 190 self.assertEqual(self.browser.headers['Status'], '200 Ok') 191 self.fill_correct_values() 192 self.browser.getControl(name="form.reg_number").value = '2345' 193 self.browser.getControl(name="form.firstname").value = 'Anna' 194 self.browser.getControl("Save").click() 195 self.assertMatches('...Form has been saved...', self.browser.contents) 196 self.browser.getControl("Add online payment ticket").click() 197 self.assertMatches('...Payment ticket created...', 198 self.browser.contents) 199 self.assertMatches('...Amount Authorized...', 200 self.browser.contents) 201 payment_id = self.pgapplicant.keys()[0] 202 payment = self.pgapplicant[payment_id] 203 self.assertEqual(payment.p_item,'This is the pgft2011 container') 204 self.assertEqual(payment.p_session,2011) 205 self.assertEqual(payment.p_category,'application') 206 self.assertEqual(payment.amount_auth, 300.0) 152 207 return 153 208 -
main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py
r8430 r8526 19 19 """ 20 20 21 from time import time 21 22 import sys 22 23 import grok … … 35 36 'sandwich': ['Part Time Degree in Education', 'SAND'], 36 37 'pt': ['Part-Time Degree Programmes', 'PTP'], 37 'pu me': ['Post UME Screening Test', 'PUME'],38 'putme': ['Post UTME Screening Test', 'PUTME'], 38 39 'app': ['General Studies', 'APP'], 39 40 'cest': ['Common Entry Screening Test', 'CEST'], … … 56 57 'form.presently_inst': _(u'Presently attending a course or programme'), 57 58 } 59 60 def setPaymentDetails(self, container, payment): 61 """Set the payment data of an applicant. 62 """ 63 timestamp = "%d" % int(time()*1000) 64 payment.p_id = "p%s" % timestamp 65 payment.p_item = container.title 66 payment.p_session = container.year 67 payment.p_category = 'application' 68 # We are using the container specific application fee 69 # instead of the session configuration application fee. 70 payment.amount_auth = container.application_fee 71 return None
Note: See TracChangeset for help on using the changeset viewer.