Changeset 16548 for main/waeup.aaue/trunk/src/waeup/aaue/applicants
- Timestamp:
- 13 Jul 2021, 16:25:31 (3 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/applicants
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py
r16003 r16548 407 407 408 408 def display_fileupload(self, filename): 409 if filename[1] == 'stateresult .pdf':409 if filename[1] == 'stateresult': 410 410 if self.target in ('trans', 'cert'): 411 411 return True 412 if filename[1] == 'verificationdoc .pdf':412 if filename[1] == 'verificationdoc': 413 413 if self.target in ('ver', 'send'): 414 414 return True … … 464 464 465 465 def display_fileupload(self, filename): 466 if filename[1] == 'stateresult .pdf':466 if filename[1] == 'stateresult': 467 467 if self.target in ('trans', 'cert'): 468 468 return True 469 if filename[1] == 'verificationdoc .pdf':469 if filename[1] == 'verificationdoc': 470 470 if self.target in ('ver', 'send'): 471 471 return True … … 486 486 return _('Passport picture confirmation box not ticked.') 487 487 if self.target in ('trans', 'cert') and \ 488 not store.getFileByContext(self.context, attr=u'stateresult .pdf'):488 not store.getFileByContext(self.context, attr=u'stateresult'): 489 489 return _('No statement of result pdf file uploaded.') 490 490 if self.target in ('ver',) and \ 491 not store.getFileByContext(self.context, attr=u'verificationdoc .pdf'):491 not store.getFileByContext(self.context, attr=u'verificationdoc'): 492 492 return _('No pdf file uploaded.') 493 493 if self.target == 'fedex': … … 785 785 """Renders the pdf form extension for applicants. 786 786 """ 787 grok.name('stateresult .pdf')787 grok.name('stateresult') 788 788 789 789 class VerificationDoc(AdditionalFile): 790 790 """Renders the pdf form extension for applicants. 791 791 """ 792 grok.name('verificationdoc .pdf')792 grok.name('verificationdoc') -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser_templates/applicanteditpage.pt
r16135 r16548 53 53 <p tal:condition="python:view.file_exists(filename[1])"> 54 54 <a tal:attributes="href python:filename[1]"i18n:translate=""> 55 Download pdffile55 Download file 56 56 </a> 57 57 </p> … … 66 66 </div> 67 67 <span i18n:translate=""> 68 PDF files only. Max. file size:68 PDF or JPG files only. Max. file size: 69 69 </span> 70 70 <span tal:replace="view/max_file_upload_size">10 KB</span> -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py
r16240 r16548 32 32 from waeup.kofa.applicants.tests.test_browser import ( 33 33 ApplicantsFullSetup, container_name_1, session_1) 34 35 SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg') 34 36 35 37 class CustomApplicantUITest(ApplicantsFullSetup): … … 344 346 self.browser.open(self.transapplicant_manage_path) 345 347 # Create a pseudo file with acceptable size 346 pdf_content = 'A' * 1024 * 300 # A string of 300 KB size 347 pseudo_pdf = StringIO(pdf_content) 348 ctrl = self.browser.getControl(name='stateresult.pdf') 348 #pdf_content = 'A' * 1024 * 300 # A string of 300 KB size 349 #pseudo_pdf = StringIO(pdf_content) 350 image = open(SAMPLE_IMAGE, 'rb') 351 ctrl = self.browser.getControl(name='stateresult') 349 352 file_ctrl = ctrl.mech_control 350 file_ctrl.add_file( pseudo_pdf, filename='myform.pdf')353 file_ctrl.add_file(image, filename='my_scan.jpg') 351 354 self.browser.getControl("Save").click() # submit form 352 355 # Even though the form could not be saved ... 353 356 self.assertTrue('Required input is missing' in self.browser.contents) 354 357 # ... the file has been successfully uploaded 355 pdf_url = self.transapplicant_manage_path.replace('manage', 'stateresult.pdf')356 self.browser.open( pdf_url)358 image_url = self.transapplicant_manage_path.replace('manage', 'stateresult') 359 self.browser.open(image_url) 357 360 self.assertEqual( 358 self.browser.headers['content-type'], ' application/pdf')359 self.assertEqual(len(self.browser.contents), 307200)361 self.browser.headers['content-type'], 'image/jpeg') 362 self.assertEqual(len(self.browser.contents), 2787) 360 363 # There is really a file stored for the applicant 361 364 storage = getUtility(IExtFileStore) … … 365 368 fd = storage.getFile(file_id) 366 369 file_len = len(fd.read()) 367 self.assertEqual(file_len, 307200)370 self.assertEqual(file_len, 2787) 368 371 # A file link is displayed on the edit view ... 369 372 self.browser.open(self.transapplicant_manage_path) 370 self.assertTrue('<a href="stateresult .pdf">' in self.browser.contents)373 self.assertTrue('<a href="stateresult">' in self.browser.contents) 371 374 # ... and on the dislay view 372 375 self.browser.open(self.transapplicant_view_path) 373 self.assertTrue('stateresult .pdf">Statement of Result</a>'376 self.assertTrue('stateresult">Statement of Result</a>' 374 377 in self.browser.contents) 375 378 # Adding file is properly logged … … 416 419 self.browser.open(self.verapplicant_manage_path) 417 420 # Create a pseudo file with acceptable size 418 pdf_content = 'A' * 1024 * 300 # A string of 300 KB size 419 pseudo_pdf = StringIO(pdf_content) 420 ctrl = self.browser.getControl(name='verificationdoc.pdf') 421 #pdf_content = 'A' * 1024 * 300 # A string of 300 KB size 422 #pseudo_pdf = StringIO(pdf_content) 423 image = open(SAMPLE_IMAGE, 'rb') 424 ctrl = self.browser.getControl(name='verificationdoc') 421 425 file_ctrl = ctrl.mech_control 422 file_ctrl.add_file( pseudo_pdf, filename='myform.pdf')426 file_ctrl.add_file(image, filename='my_scan.jpg') 423 427 self.browser.getControl("Save").click() # submit form 424 428 # Even though the form could not be saved ... 425 429 self.assertTrue('Required input is missing' in self.browser.contents) 426 430 # ... the file has been successfully uploaded 427 pdf_url = self.verapplicant_manage_path.replace('manage', 'verificationdoc.pdf')428 self.browser.open( pdf_url)431 image_url = self.verapplicant_manage_path.replace('manage', 'verificationdoc') 432 self.browser.open(image_url) 429 433 self.assertEqual( 430 self.browser.headers['content-type'], ' application/pdf')431 self.assertEqual(len(self.browser.contents), 307200)434 self.browser.headers['content-type'], 'image/jpeg') 435 self.assertEqual(len(self.browser.contents), 2787) 432 436 # There is really a file stored for the applicant 433 437 storage = getUtility(IExtFileStore) … … 437 441 fd = storage.getFile(file_id) 438 442 file_len = len(fd.read()) 439 self.assertEqual(file_len, 307200)443 self.assertEqual(file_len, 2787) 440 444 # A file link is displayed on the edit view ... 441 445 self.browser.open(self.verapplicant_manage_path) 442 self.assertTrue('<a href="verificationdoc .pdf">' in self.browser.contents)446 self.assertTrue('<a href="verificationdoc">' in self.browser.contents) 443 447 # ... and on the dislay view 444 448 self.browser.open(self.verapplicant_view_path) 445 self.assertTrue('verificationdoc .pdf">Result/Certificate Document</a>'449 self.assertTrue('verificationdoc">Result/Certificate Document</a>' 446 450 in self.browser.contents) 447 451 # Adding file is properly logged … … 454 458 % (self.verapplicant.applicant_id) 455 459 in logcontent) 456 # When an applicant is removed, also the pdffiles are gone.460 # When an applicant is removed, also the files are gone. 457 461 del self.app['applicants'][self.vercontainer.code][self.verapplicant.application_number] 458 462 fd = storage.getFile(file_id) -
main/waeup.aaue/trunk/src/waeup/aaue/applicants/utils.py
r16135 r16548 28 28 """ 29 29 30 ADDITIONAL_FILES = (('Statement of Result','stateresult .pdf'),31 ('Result/Certificate Document','verificationdoc .pdf'))30 ADDITIONAL_FILES = (('Statement of Result','stateresult'), 31 ('Result/Certificate Document','verificationdoc')) 32 32 33 33 APP_TYPES_DICT = {
Note: See TracChangeset for help on using the changeset viewer.