Changeset 16546 for main


Ignore:
Timestamp:
13 Jul 2021, 16:05:29 (3 years ago)
Author:
Henrik Bettermann
Message:

Adjust to changes in base package.

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  
    414414
    415415class ResultStatement(AdditionalFile):
    416     grok.name('res_stat.pdf')
     416    grok.name('res_stat')
    417417
    418418class JAMBResult(AdditionalFile):
    419     grok.name('jamb.pdf')
     419    grok.name('jamb')
    420420
    421421class FirstSitting(AdditionalFile):
    422     grok.name('fst_sit_scan.pdf')
     422    grok.name('fst_sit_scan')
    423423
    424424class SecondSitting(AdditionalFile):
    425     grok.name('scd_sit_scan.pdf')
     425    grok.name('scd_sit_scan')
    426426
    427427class HighQual(AdditionalFile):
    428     grok.name('hq_scan.pdf')
     428    grok.name('hq_scan')
    429429
    430430class AdvancedLevelResult(AdditionalFile):
    431     grok.name('alr_scan.pdf')
     431    grok.name('alr_scan')
    432432
    433433class NYSCCertificate(AdditionalFile):
    434     grok.name('nysc.pdf')
     434    grok.name('nysc')
    435435
    436436class 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  
    112112              <p tal:condition="python:view.file_exists(filename[1])">
    113113                <a tal:attributes="href python:filename[1]"i18n:translate="">
    114                   Download pdf file
     114                  Download file
    115115                </a>
    116116              </p>
     
    125125              </div>
    126126              <span i18n:translate="">
    127                 PDF files only. Max. file size:
     127                JPG or PDF files only. Max. file size:
    128128              </span>
    129129              <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  
    4141from kofacustom.iuokada.applicants.export import CustomApplicantExporter
    4242from kofacustom.iuokada.applicants.batching import CustomApplicantProcessor
     43
     44SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
    4345
    4446class CustomApplicantUITests(ApplicantsFullSetup):
     
    159161        self.browser.open(self.transapplicant_manage_path)
    160162        # 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')
    164167        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')
    166169        self.browser.getControl("Save").click() # submit form
    167170        # Even though the form could not be saved ...
    168171        self.assertTrue('Required input is missing' in self.browser.contents)
    169172        # ... 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)
    172175        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)
    175178        # There is really a file stored for the applicant
    176179        storage = getUtility(IExtFileStore)
     
    180183        fd = storage.getFile(file_id)
    181184        file_len = len(fd.read())
    182         self.assertEqual(file_len, 307200)
     185        self.assertEqual(file_len, 2787)
    183186        # A file link is displayed on the edit view ...
    184187        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)
    186189        # ... and on the dislay view
    187190        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>'
    189192            in self.browser.contents)
    190193        # Adding file is properly logged
     
    194197        self.assertTrue(
    195198            'zope.mgr - kofacustom.iuokada.applicants.browser.CustomApplicantManageFormPage'
    196             ' - %s - saved: res_stat.pdf'
     199            ' - %s - saved: res_stat'
    197200            % (self.transapplicant.applicant_id)
    198201            in logcontent)
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/utils.py

    r16535 r16546  
    3535
    3636    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'),
    4545                 )
    4646
Note: See TracChangeset for help on using the changeset viewer.