Changeset 10570 for main/waeup.fceokene


Ignore:
Timestamp:
31 Aug 2013, 08:19:05 (11 years ago)
Author:
Henrik Bettermann
Message:

UG programmes (utme and de) are in affiliation with Ibadan. Use appropriate header in slips.

Location:
main/waeup.fceokene/trunk/src/waeup/fceokene
Files:
3 edited

Legend:

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

    r10533 r10570  
    2626    PaymentReceiptActionButton, PDFActionButton)
    2727from waeup.kofa.applicants.pdf import PDFApplicationSlip
     28from waeup.kofa.interfaces import IKofaUtils
     29from waeup.kofa.browser.interfaces import IPDFCreator
    2830
    2931from kofacustom.nigeria.applicants.browser import (
    3032    NigeriaExportPDFPaymentSlipPage, NigeriaApplicantManageFormPage,
    3133    NigeriaApplicantDisplayFormPage, NigeriaApplicantEditFormPage)
     34
     35from waeup.fceokene.interfaces import MessageFactory as _
    3236
    3337from kofacustom.nigeria.applicants.interfaces import (
     
    8084    def _reduced_slip(self):
    8185        return getattr(self.context, 'result_uploaded', False)
     86
     87    def _getPDFCreator(self):
     88        if 'putme' in self.target or 'pude' in self.target:
     89            return getUtility(IPDFCreator, name='ibadan_pdfcreator')
     90        return getUtility(IPDFCreator)
     91
     92    @property
     93    def title(self):
     94        container_title = self.context.__parent__.title
     95        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     96        ar_translation = translate(_('Application Record'),
     97            'waeup.kofa', target_language=portal_language)
     98        if 'putme' in self.target or 'pude' in self.target:
     99            return 'IN AFFILIATION WITH UNIVERSITY OF IBADAN - %s %s %s' % (
     100                container_title, ar_translation,
     101                self.context.application_number)
     102        return '%s - %s %s' % (container_title,
     103            ar_translation, self.context.application_number)
     104
    82105
    83106    @property
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/tests/test_browser.py

    r9943 r10570  
    6363        self.beccontainer.title = u'This is the bec2011 container'
    6464        self.app['applicants']['bec2011'] = self.beccontainer
    65 
    6665        delta = datetime.timedelta(days=10)
    6766        self.beccontainer.startdate = datetime.datetime.now(pytz.utc) - delta
    6867        self.beccontainer.enddate = datetime.datetime.now(pytz.utc) + delta
     68
     69        # Add ug applicants container
     70        self.putmecontainer = ApplicantsContainer()
     71        self.putmecontainer.mode = 'create'
     72        self.putmecontainer.code = u'putme2011'
     73        self.putmecontainer.prefix = u'putme'
     74        self.putmecontainer.application_category = u'bec' # doesn't matter
     75        self.putmecontainer.year = 2011
     76        self.putmecontainer.application_fee = 300.0
     77        self.putmecontainer.title = u'This is the putme2011 container'
     78        self.app['applicants']['putme2011'] = self.putmecontainer
     79        delta = datetime.timedelta(days=10)
     80        self.putmecontainer.startdate = datetime.datetime.now(pytz.utc) - delta
     81        self.putmecontainer.enddate = datetime.datetime.now(pytz.utc) + delta
    6982
    7083        # Populate university
     
    91104            % self.becapplication_number)
    92105
     106        putmeapplicant = createObject(u'waeup.Applicant')
     107        putmeapplicant.firstname = u'Anna'
     108        putmeapplicant.lastname = u'Post'
     109        self.app['applicants']['putme2011'].addApplicant(putmeapplicant)
     110        self.putmeapplication_number = putmeapplicant.application_number
     111        self.putmeapplicant = self.app['applicants']['putme2011'][
     112            self.putmeapplication_number]
     113        self.putmeapplicant_path = ('http://localhost/app/applicants/putme2011/%s'
     114            % self.putmeapplication_number)
     115
    93116        self.browser = Browser()
    94117        self.browser.handleErrors = False
     
    110133        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    111134
    112     def test_manage_and_view_applicant(self):
     135    def test_manage_and_view_bec_applicant(self):
    113136        # Managers can manage bec applicants.
    114137        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    125148        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    126149        return
     150
     151    def test_manage_and_view_putme_applicant(self):
     152        # Managers can manage bec applicants.
     153        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     154        self.browser.open(self.putmeapplicant_path)
     155        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     156        self.assertTrue("'O' Level" in self.browser.contents)
     157        self.browser.open(self.putmeapplicant_path + '/manage')
     158        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     159        self.assertTrue("'O' Level" in self.browser.contents)
     160        self.browser.open(self.putmeapplicant_path + '/edit')
     161        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     162        self.assertTrue("'O' Level" in self.browser.contents)
     163        self.browser.open(self.putmeapplicant_path + '/application_slip.pdf')
     164        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     165        return
  • main/waeup.fceokene/trunk/src/waeup/fceokene/utils/utils.py

    r9989 r10570  
    2929
    3030    APP_CATS_DICT = {
    31         'basic': 'PUTME, PUDE, PCE, PRENCE',
     31        'basic': 'UTME, DE, PCE, PRENCE',
    3232        'no': 'No Application',
    3333        'sandwich': 'Sandwich',
Note: See TracChangeset for help on using the changeset viewer.