Ignore:
Timestamp:
28 Jul 2020, 10:19:11 (4 years ago)
Author:
Henrik Bettermann
Message:

Customize transcript application slip.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py

    r16178 r16184  
    623623    @property
    624624    def form_fields(self):
    625         if self.target == 'ictwk':
     625        if self.target is not None and self.target == 'tscf':
     626            form_fields = grok.AutoFields(ITranscriptApplicant)
     627            for field in TRANS_OMIT_FIELDS:
     628                form_fields = form_fields.omit(field)
     629        elif self.target is not None and self.target == 'tscs':
     630            form_fields = grok.AutoFields(ITranscriptApplicant)
     631            for field in TRANS_SHORT_OMIT_FIELDS:
     632                form_fields = form_fields.omit(field)
     633        elif self.target is not None and self.target == 'ictwk':
    626634            form_fields = grok.AutoFields(IUnibenRegistration)
    627635            for field in REGISTRATION_OMIT_PDF_FIELDS:
    628636                form_fields = form_fields.omit(field)
    629             return form_fields
    630         if self.target is not None and self.target.startswith('pg'):
     637        elif self.target is not None and self.target.startswith('pg'):
    631638            form_fields = grok.AutoFields(ICustomPGApplicant)
    632639            for field in PG_OMIT_PDF_FIELDS:
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests/test_browser.py

    r16183 r16184  
    174174
    175175        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    176         self.slip_path = self.view_path + '/application_slip.pdf'
    177176        self.browser.open(self.manage_path)
    178177        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     
    294293        print "Sample ictwk_application_slip.pdf written to %s" % path
    295294
    296     def test_transcript_payment(self):
     295    def test_transcript_application(self):
    297296        configuration = CustomSessionConfiguration()
    298297        configuration.academic_session = session_1
     
    308307        applicantscontainer.mode = 'create'
    309308        applicantscontainer.strict_deadline = True
    310         applicantscontainer.with_picture = False
     309        applicantscontainer.with_picture = True
    311310        delta = datetime.timedelta(days=10)
    312311        applicantscontainer.startdate = datetime.datetime.now(pytz.utc) - delta
     
    337336        self.browser.getControl(name="form.course_studied").value = ['CERT1']
    338337        self.browser.getControl(name="form.matric_number").value = '234'
    339         self.browser.getControl(name="form.dispatch_address").value = 'Kuensche'
     338        self.browser.getControl(name="form.dispatch_address").value = 'Kuensche\nMarsch 5'
    340339        self.browser.getControl(name="form.entry_mode").value = ['ug_ft']
    341340        self.browser.getControl(name="form.entry_session").value = ['2014']
     
    344343        self.browser.getControl(name="form.phone.ext").value = '5678'
    345344        self.browser.getControl(name="form.charge").value = ['nigeria']
     345        image = open(SAMPLE_IMAGE, 'rb')
     346        ctrl = self.browser.getControl(name='form.passport')
     347        file_ctrl = ctrl.mech_control
     348        file_ctrl.add_file(image, filename='myphoto.jpg')
    346349        self.browser.getControl("Save").click()
    347350        self.browser.getControl("Add online payment ticket").click()
     
    349352        self.assertTrue('<span>40000.0</span>' in self.browser.contents)
    350353        self.assertEqual(applicant.values()[0].amount_auth, 40000.0)
     354        IWorkflowState(applicant).setState('submitted')
     355        self.browser.getLink("My Data").click()
     356        self.browser.getLink("Download application slip").click()
     357        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     358        self.assertEqual(self.browser.headers['Content-Type'],
     359                         'application/pdf')
     360        path = os.path.join(samples_dir(), 'tscf_application_slip.pdf')
     361        open(path, 'wb').write(self.browser.contents)
     362        print "Sample tscf_application_slip.pdf written to %s" % path
    351363        return
Note: See TracChangeset for help on using the changeset viewer.