Changeset 14732 for main/kofacustom.dspg


Ignore:
Timestamp:
27 Jul 2017, 05:22:28 (7 years ago)
Author:
Henrik Bettermann
Message:

Require uploading of picture before payment.

Location:
main/kofacustom.dspg/trunk/src/kofacustom/dspg
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/applicants/browser.py

    r14721 r14732  
    2323from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    2424from zope.formlib.textwidgets import BytesDisplayWidget
     25from waeup.kofa.interfaces import IExtFileStore, IKofaUtils
    2526from waeup.kofa.applicants.interfaces import (
    2627    IApplicant, IApplicantEdit, ISpecialApplicant)
    2728from waeup.kofa.applicants.browser import (ApplicantDisplayFormPage,
    2829    ApplicantManageFormPage, ApplicantEditFormPage,
    29     ApplicantsContainerPage)
     30    ApplicantsContainerPage, ApplicationFeePaymentAddPage)
    3031from waeup.kofa.applicants.viewlets import (
    3132    PaymentReceiptActionButton, PDFActionButton)
     
    4546    )
    4647
     48from kofacustom.dspg.interfaces import MessageFactory as _
     49
    4750UG_OMIT_EDIT_FIELDS = [
    4851    value for value in UG_OMIT_EDIT_FIELDS
     
    196199        form_fields['reg_number'].for_display = True
    197200        return form_fields
     201
     202class CustomApplicationFeePaymentAddPage(ApplicationFeePaymentAddPage):
     203    """ Page to add an online payment ticket
     204    """
     205
     206    @property
     207    def custom_requirements(self):
     208        store = getUtility(IExtFileStore)
     209        if not store.getFileByContext(self.context, attr=u'passport.jpg'):
     210            return _('Upload your passport photo before making payment.')
     211        return ''
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/interswitch/tests.py

    r14716 r14732  
    3030#   do exist really and are not bothered by being spammed by a test programme.
    3131EXTERNAL_TESTS = False
     32
     33SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
    3234
    3335def external_test(func):
     
    217219        self.browser.getControl("Save").click()
    218220        self.browser.getControl("Add online").click()
     221        self.assertMatches('...passport photo before making payment...',
     222                           self.browser.contents)
     223        self.browser.open(self.manage_path)
     224        super(InterswitchTestsApplicants, self).fill_correct_values()
     225        self.browser.getControl(name="form.nationality").value = ['NG']
     226        #self.browser.getControl(name="transition").value = ['start']
     227        image = open(SAMPLE_IMAGE, 'rb')
     228        ctrl = self.browser.getControl(name='form.passport')
     229        file_ctrl = ctrl.mech_control
     230        file_ctrl.add_file(image, filename='myphoto.jpg')
     231        self.browser.getControl("Save").click()
     232        self.browser.getControl("Add online").click()
    219233        self.assertMatches('...ticket created...',
    220234                           self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.