Changeset 16546
- Timestamp:
- 13 Jul 2021, 16:05:29 (3 years ago)
- Location:
- main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/browser.py
r16535 r16546 414 414 415 415 class ResultStatement(AdditionalFile): 416 grok.name('res_stat .pdf')416 grok.name('res_stat') 417 417 418 418 class JAMBResult(AdditionalFile): 419 grok.name('jamb .pdf')419 grok.name('jamb') 420 420 421 421 class FirstSitting(AdditionalFile): 422 grok.name('fst_sit_scan .pdf')422 grok.name('fst_sit_scan') 423 423 424 424 class SecondSitting(AdditionalFile): 425 grok.name('scd_sit_scan .pdf')425 grok.name('scd_sit_scan') 426 426 427 427 class HighQual(AdditionalFile): 428 grok.name('hq_scan .pdf')428 grok.name('hq_scan') 429 429 430 430 class AdvancedLevelResult(AdditionalFile): 431 grok.name('alr_scan .pdf')431 grok.name('alr_scan') 432 432 433 433 class NYSCCertificate(AdditionalFile): 434 grok.name('nysc .pdf')434 grok.name('nysc') 435 435 436 436 class PaymentReceipts(AdditionalFile): 437 grok.name('rmp .pdf')437 grok.name('rmp') -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/browser_templates/applicanteditpage.pt
r16165 r16546 112 112 <p tal:condition="python:view.file_exists(filename[1])"> 113 113 <a tal:attributes="href python:filename[1]"i18n:translate=""> 114 Download pdffile114 Download file 115 115 </a> 116 116 </p> … … 125 125 </div> 126 126 <span i18n:translate=""> 127 PDF files only. Max. file size:127 JPG or PDF files only. Max. file size: 128 128 </span> 129 129 <span tal:replace="view/max_file_upload_size">10 KB</span> -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/tests/test_browser.py
r16292 r16546 41 41 from kofacustom.iuokada.applicants.export import CustomApplicantExporter 42 42 from kofacustom.iuokada.applicants.batching import CustomApplicantProcessor 43 44 SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg') 43 45 44 46 class CustomApplicantUITests(ApplicantsFullSetup): … … 159 161 self.browser.open(self.transapplicant_manage_path) 160 162 # Create a pseudo file with acceptable size 161 pdf_content = 'A' * 1024 * 300 # A string of 300 KB size 162 pseudo_pdf = StringIO(pdf_content) 163 ctrl = self.browser.getControl(name='res_stat.pdf') 163 #pdf_content = 'A' * 1024 * 300 # A string of 300 KB size 164 #pseudo_pdf = StringIO(pdf_content) 165 image = open(SAMPLE_IMAGE, 'rb') 166 ctrl = self.browser.getControl(name='res_stat') 164 167 file_ctrl = ctrl.mech_control 165 file_ctrl.add_file( pseudo_pdf, filename='myform.pdf')168 file_ctrl.add_file(image, filename='my_scan.jpg') 166 169 self.browser.getControl("Save").click() # submit form 167 170 # Even though the form could not be saved ... 168 171 self.assertTrue('Required input is missing' in self.browser.contents) 169 172 # ... the file has been successfully uploaded 170 pdf_url = self.transapplicant_manage_path.replace('manage', 'res_stat.pdf')171 self.browser.open( pdf_url)173 image_url = self.transapplicant_manage_path.replace('manage', 'res_stat') 174 self.browser.open(image_url) 172 175 self.assertEqual( 173 self.browser.headers['content-type'], ' application/pdf')174 self.assertEqual(len(self.browser.contents), 307200)176 self.browser.headers['content-type'], 'image/jpeg') 177 self.assertEqual(len(self.browser.contents), 2787) 175 178 # There is really a file stored for the applicant 176 179 storage = getUtility(IExtFileStore) … … 180 183 fd = storage.getFile(file_id) 181 184 file_len = len(fd.read()) 182 self.assertEqual(file_len, 307200)185 self.assertEqual(file_len, 2787) 183 186 # A file link is displayed on the edit view ... 184 187 self.browser.open(self.transapplicant_manage_path) 185 self.assertTrue('<a href="res_stat .pdf">' in self.browser.contents)188 self.assertTrue('<a href="res_stat">' in self.browser.contents) 186 189 # ... and on the dislay view 187 190 self.browser.open(self.transapplicant_view_path) 188 self.assertTrue('res_stat .pdf">Statement of Result</a>'191 self.assertTrue('res_stat">Statement of Result</a>' 189 192 in self.browser.contents) 190 193 # Adding file is properly logged … … 194 197 self.assertTrue( 195 198 'zope.mgr - kofacustom.iuokada.applicants.browser.CustomApplicantManageFormPage' 196 ' - %s - saved: res_stat .pdf'199 ' - %s - saved: res_stat' 197 200 % (self.transapplicant.applicant_id) 198 201 in logcontent) -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/utils.py
r16535 r16546 35 35 36 36 ADDITIONAL_FILES = ( 37 ('First Sitting Result (WAEC/NECO)','fst_sit_scan .pdf'),38 ('Second Sitting Result (WAEC/NECO)','scd_sit_scan .pdf'),39 ('Higher Qualification Result','hq_scan .pdf'),40 ('Advanced Level Result','alr_scan .pdf'),41 ('JAMB Result','jamb .pdf'),42 ('Statement of Result','res_stat .pdf'),43 ('NYSC Certificate','nysc .pdf'),44 ('Receipts for Manual Payments','rmp .pdf'),37 ('First Sitting Result (WAEC/NECO)','fst_sit_scan'), 38 ('Second Sitting Result (WAEC/NECO)','scd_sit_scan'), 39 ('Higher Qualification Result','hq_scan'), 40 ('Advanced Level Result','alr_scan'), 41 ('JAMB Result','jamb'), 42 ('Statement of Result','res_stat'), 43 ('NYSC Certificate','nysc'), 44 ('Receipts for Manual Payments','rmp'), 45 45 ) 46 46
Note: See TracChangeset for help on using the changeset viewer.