Changeset 8528 for main


Ignore:
Timestamp:
26 May 2012, 10:46:13 (13 years ago)
Author:
Henrik Bettermann
Message:

See r8526.

The comment in r8627 refers to this revision.

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

Legend:

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

    r8520 r8528  
    153153    factory = u'waeup.CustomApplicantOnlinePayment'
    154154
    155     def _fillCustomFields(self, payment, session_config):
    156         # No custom fields at the moment
    157         return payment
    158 
    159155class CustomExportPDFPaymentSlipPage(ExportPDFPaymentSlipPage):
    160156    """Deliver a PDF slip of the context.
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/tests.py

    r8520 r8528  
    3030from waeup.kofa.university.department import Department
    3131from waeup.kofa.testing import FunctionalTestCase
     32from waeup.kofa.configuration import SessionConfiguration
    3233from waeup.kofa.applicants.container import ApplicantsContainer
    3334from waeup.kofa.applicants.tests.test_batching import ApplicantImportExportSetup
     
    6364        self.pgcontainer.code = u'pgft2011'
    6465        self.pgcontainer.prefix = u'pgft'
     66        self.pgcontainer.year = 2011
     67        self.pgcontainer.application_fee = 300.0
     68        self.pgcontainer.title = u'This is the pgft2011 container'
    6569        self.app['applicants']['pgft2011'] = self.pgcontainer
    6670        self.ugcontainer = ApplicantsContainer()
    67         self.ugcontainer.code = u'app2011'
    68         self.ugcontainer.prefix = u'app'
     71        self.ugcontainer.code = u'putme2011'
     72        self.ugcontainer.prefix = u'putme'
     73        self.ugcontainer.year = 2011
     74        self.ugcontainer.application_fee = 200.0
     75        self.ugcontainer.title = u'This is the app2011 container'
    6976        self.app['applicants']['app2011'] = self.ugcontainer
    7077
     
    96103        self.ugapplicant = self.app['applicants']['app2011'][
    97104            self.ugapplication_number]
     105        self.pgapplicant_path = ('http://localhost/app/applicants/pgft2011/%s'
     106            % self.pgapplication_number)
     107        self.ugapplicant_path = ('http://localhost/app/applicants/app2011/%s'
     108            % self.ugapplication_number)
    98109
    99110        self.browser = Browser()
     
    106117        return
    107118
    108     def test_manage_and_view_applicant(self):
    109         # Managers can manage pg applicants
    110         pgapplicant_path = ('http://localhost/app/applicants/pgft2011/%s'
    111             % self.pgapplication_number)
    112         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    113         # The IPGApplicant interface is really used in all pages
    114         self.browser.open(pgapplicant_path)
    115         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    116         self.assertTrue('Employer' in self.browser.contents)
    117         self.browser.open(pgapplicant_path + '/manage')
    118         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    119         self.assertTrue('Employer' in self.browser.contents)
    120         self.browser.open(pgapplicant_path + '/edit')
    121         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    122         self.assertTrue('Employer' in self.browser.contents)
    123         self.browser.open(pgapplicant_path + '/application_slip.pdf')
    124         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    125         # If we view the applicant in the ug container,
    126         # the employer field doesn't appear
    127         ugapplicant_path = ('http://localhost/app/applicants/app2011/%s'
    128             % self.ugapplication_number)
    129         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    130         self.browser.open(ugapplicant_path)
    131         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    132         self.assertFalse('Employer' in self.browser.contents)
    133         self.browser.open(ugapplicant_path + '/manage')
    134         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    135         # We can save the applicant
     119    def fill_correct_values(self):
    136120        self.browser.getControl(name="form.reg_number").value = '1234'
    137121        self.browser.getControl(name="form.firstname").value = 'John'
     
    142126        self.browser.getControl(name="form.sex").value = ['m']
    143127        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     128
     129    def test_manage_and_view_applicant(self):
     130        # Managers can manage pg applicants
     131        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     132        # The IPGApplicant interface is really used in all pages
     133        self.browser.open(self.pgapplicant_path)
     134        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     135        self.assertTrue('Employer' in self.browser.contents)
     136        self.browser.open(self.pgapplicant_path + '/manage')
     137        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     138        self.assertTrue('Employer' in self.browser.contents)
     139        self.browser.open(self.pgapplicant_path + '/edit')
     140        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     141        self.assertTrue('Employer' in self.browser.contents)
     142        self.browser.open(self.pgapplicant_path + '/application_slip.pdf')
     143        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     144        # If we view the applicant in the ug container,
     145        # the employer field doesn't appear
     146        self.browser.open(self.ugapplicant_path)
     147        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     148        self.assertFalse('Employer' in self.browser.contents)
     149        self.browser.open(self.ugapplicant_path + '/manage')
     150        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     151        # We can save the applicant
     152        self.fill_correct_values()
    144153        self.browser.getControl("Save").click()
    145154        self.assertMatches('...Form has been saved...', self.browser.contents)
    146155        self.assertFalse('Employer' in self.browser.contents)
    147         self.browser.open(ugapplicant_path + '/edit')
     156        self.browser.open(self.ugapplicant_path + '/edit')
    148157        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    149158        self.assertFalse('Employer' in self.browser.contents)
    150         self.browser.open(ugapplicant_path + '/application_slip.pdf')
    151         self.assertEqual(self.browser.headers['Status'], '200 Ok')
     159        self.browser.open(self.ugapplicant_path + '/application_slip.pdf')
     160        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     161        return
     162
     163    def test_application_payment(self):
     164        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     165
     166        # UG (UTME) applicant
     167        self.browser.open(self.ugapplicant_path)
     168        self.browser.open(self.ugapplicant_path + '/manage')
     169        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     170        self.fill_correct_values()
     171        self.browser.getControl("Save").click()
     172        self.assertMatches('...Form has been saved...', self.browser.contents)
     173        self.fill_correct_values()
     174        self.browser.getControl("Save").click()
     175        self.browser.getControl("Add online payment ticket").click()
     176        self.assertMatches('...Payment ticket created...',
     177                           self.browser.contents)
     178        self.assertMatches('...Amount Authorized...',
     179                           self.browser.contents)
     180        payment_id = self.ugapplicant.keys()[0]
     181        payment = self.ugapplicant[payment_id]
     182        self.assertEqual(payment.p_item,'This is the app2011 container')
     183        self.assertEqual(payment.p_session,2011)
     184        self.assertEqual(payment.p_category,'application')
     185        self.assertEqual(payment.amount_auth, 200.0)
     186
     187        # PG applicants pay more
     188        self.browser.open(self.pgapplicant_path)
     189        self.browser.open(self.pgapplicant_path + '/manage')
     190        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     191        self.fill_correct_values()
     192        self.browser.getControl(name="form.reg_number").value = '2345'
     193        self.browser.getControl(name="form.firstname").value = 'Anna'
     194        self.browser.getControl("Save").click()
     195        self.assertMatches('...Form has been saved...', self.browser.contents)
     196        self.browser.getControl("Add online payment ticket").click()
     197        self.assertMatches('...Payment ticket created...',
     198                           self.browser.contents)
     199        self.assertMatches('...Amount Authorized...',
     200                           self.browser.contents)
     201        payment_id = self.pgapplicant.keys()[0]
     202        payment = self.pgapplicant[payment_id]
     203        self.assertEqual(payment.p_item,'This is the pgft2011 container')
     204        self.assertEqual(payment.p_session,2011)
     205        self.assertEqual(payment.p_category,'application')
     206        self.assertEqual(payment.amount_auth, 300.0)
    152207        return
    153208
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/utils.py

    r8460 r8528  
    1919"""
    2020
     21from time import time
    2122import sys
    2223import grok
     
    3536        'sandwich': ['Part Time Degree in Education', 'SAND'],
    3637        'pt': ['Part-Time Degree Programmes', 'PTP'],
    37         'pume': ['Post UME Screening Test', 'PUME'],
     38        'putme': ['Post UTME Screening Test', 'PUTME'],
    3839        'app': ['General Studies', 'APP'],
    3940        'cest': ['Common Entry Screening Test', 'CEST'],
     
    5657        'form.presently_inst': _(u'Presently attending a course or programme'),
    5758        }
     59
     60    def setPaymentDetails(self, container, payment):
     61        """Set the payment data of an applicant.
     62        """
     63        timestamp = "%d" % int(time()*1000)
     64        payment.p_id = "p%s" % timestamp
     65        payment.p_item = container.title
     66        payment.p_session = container.year
     67        payment.p_category = 'application'
     68        # We are using the container specific application fee
     69        # instead of the session configuration application fee.
     70        payment.amount_auth = container.application_fee
     71        return None
  • main/waeup.fceokene/trunk/src/waeup/fceokene/interfaces.py

    r8504 r8528  
    102102
    103103    application_fee = schema.Float(
    104         title = _(u'Application Fee'),
     104        title = _(u'Application Fee (ignored)'),
    105105        default = 0.0,
    106106        required = False,
  • main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch/tests.py

    r8460 r8528  
    130130        #IWorkflowState(self.student).setState('started')
    131131        super(InterswitchTestsApplicants, self).fill_correct_values()
     132        self.applicantscontainer.application_fee = 1000.0
    132133        self.browser.getControl(name="transition").value = ['start']
    133134        self.browser.getControl("Save").click()
    134         self.browser.getControl("Add online").click()
    135         self.assertTrue(
    136             'Session configuration object is not available'
    137             in self.browser.contents)
    138         configuration = SessionConfiguration()
    139         configuration.academic_session = 2009
    140         configuration.application_fee = 1000.0
    141         self.app['configuration'].addSessionConfiguration(configuration)
    142         self.browser.open(self.manage_path)
    143135        self.browser.getControl("Add online").click()
    144136        self.assertMatches('...ticket created...',
  • main/waeup.fceokene/trunk/src/waeup/fceokene/students/utils.py

    r8475 r8528  
    149149
    150150    # FCEOkene prefix
    151     STUDENT_ID_PREFIX = u'O'
     151    STUDENT_ID_PREFIX = u'K'
  • main/waeup.fceokene/trunk/src/waeup/fceokene/utils/utils.py

    r8460 r8528  
    182182        'pg_pt': 'Postgraduate Part Time',
    183183        'jm_ft': 'Joint Matriculation Full Time',
    184         'ume_ft': 'UME Full Time',
     184        'utme_ft': 'UTME Full Time',
    185185        'de_ft': 'Direct Entry Full Time',
    186186        'ph_ft': 'Post Higher Education Full Time',
     
    194194
    195195    APP_CATS_DICT = {
    196         'basic': 'PUME, PDE, PCE, PRENCE',
     196        'basic': 'PUTME, PDE, PCE, PRENCE',
    197197        'no': 'no application',
    198198        'pg_ft': 'Postgraduate Full-Time',
Note: See TracChangeset for help on using the changeset viewer.