Ignore:
Timestamp:
11 Jun 2012, 07:09:06 (12 years ago)
Author:
Henrik Bettermann
Message:

See waeup.uniben.

Remove tests for pg students. We do not have pg students in colleges.

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

Legend:

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

    r8531 r8671  
    3030    grok.provides(ICustomApplicant)
    3131
     32    create_names = Applicant.create_names + [
     33        'lga', 'nationality', 'perm_address']
     34
    3235# Set all attributes of Applicant required in IApplicant as field
    3336# properties. Doing this, we do not have to set initial attributes
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/tests.py

    r8624 r8671  
    2020import tempfile
    2121import datetime
     22import grok
     23import pytz
     24from zope.event import notify
    2225from zope.intid.interfaces import IIntIds
    2326from zope.interface.verify import verifyClass, verifyObject
     
    2629from zope.catalog.interfaces import ICatalog
    2730from zope.testbrowser.testing import Browser
     31from hurry.workflow.interfaces import IWorkflowState
    2832from waeup.kofa.app import University
    2933from waeup.kofa.university.faculty import Faculty
     
    6165        setSite(app)
    6266
    63         # Add an two different applicants containers
    64         self.pgcontainer = ApplicantsContainer()
    65         self.pgcontainer.code = u'pgft2011'
    66         self.pgcontainer.prefix = u'pgft'
    67         self.pgcontainer.application_category = u'pg_ft'
    68         self.pgcontainer.year = 2011
    69         self.pgcontainer.application_fee = 300.0
    70         self.pgcontainer.title = u'This is the pgft2011 container'
    71         self.app['applicants']['pgft2011'] = self.pgcontainer
     67        # Add an applicants containers
    7268        self.ugcontainer = ApplicantsContainer()
    7369        self.ugcontainer.code = u'putme2011'
     
    7975        self.app['applicants']['app2011'] = self.ugcontainer
    8076
     77        self.ugcontainer.mode = 'update'
     78        delta = datetime.timedelta(days=10)
     79        self.ugcontainer.startdate = datetime.datetime.now(pytz.utc) - delta
     80        self.ugcontainer.enddate = datetime.datetime.now(pytz.utc) + delta
     81
    8182        # Populate university
    8283        self.certificate = createObject('waeup.Certificate')
     
    8586        self.certificate.start_level = 100
    8687        self.certificate.end_level = 500
     88        self.certificate.study_mode = u'ug_ft'
    8789        self.app['faculties']['fac1'] = Faculty()
    8890        self.app['faculties']['fac1']['dep1'] = Department()
    8991        self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
    9092            self.certificate)
    91         self.certificate2 = createObject('waeup.Certificate')
    92         self.certificate2.code = 'CERT2'
    93         self.certificate2.application_category = 'pg_ft'
    94         self.certificate2.start_level = 100
    95         self.certificate2.end_level = 500
    96         self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
    97             self.certificate2)
    98 
    99         # Add (customized) applicants
    100         pgapplicant = createObject(u'waeup.Applicant')
    101         pgapplicant.firstname = u'Anna'
    102         pgapplicant.lastname = u'Post'
    103         self.app['applicants']['pgft2011'].addApplicant(pgapplicant)
    104         self.pgapplication_number = pgapplicant.application_number
    105         self.pgapplicant = self.app['applicants']['pgft2011'][
    106             self.pgapplication_number]
    107 
     93
     94        # Add (customized) applicant
    10895        ugapplicant = createObject(u'waeup.Applicant')
    10996        ugapplicant.firstname = u'Klaus'
     
    113100        self.ugapplicant = self.app['applicants']['app2011'][
    114101            self.ugapplication_number]
    115         self.pgapplicant_path = ('http://localhost/app/applicants/pgft2011/%s'
    116             % self.pgapplication_number)
    117102        self.ugapplicant_path = ('http://localhost/app/applicants/app2011/%s'
    118103            % self.ugapplication_number)
     
    133118        self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'
    134119        self.browser.getControl(name="form.lga").value = ['foreigner']
     120        self.browser.getControl(name="form.nationality").value = ['NG']
    135121        self.browser.getControl(name="form.sex").value = ['m']
    136122        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    137 
    138     def test_manage_and_view_applicant(self):
    139         # Managers can manage pg applicants
    140         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    141         # The IPGApplicant interface is really used in all pages
    142         self.browser.open(self.pgapplicant_path)
    143         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    144         self.assertTrue('Employer' in self.browser.contents)
    145         self.browser.open(self.pgapplicant_path + '/manage')
    146         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    147         self.assertTrue('Employer' in self.browser.contents)
    148         self.browser.open(self.pgapplicant_path + '/edit')
    149         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    150         self.assertTrue('Employer' in self.browser.contents)
    151         self.browser.open(self.pgapplicant_path + '/application_slip.pdf')
    152         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    153         # If we view the applicant in the ug container,
    154         # the employer field doesn't appear
    155         self.browser.open(self.ugapplicant_path)
    156         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    157         self.assertFalse('Employer' in self.browser.contents)
    158         self.browser.open(self.ugapplicant_path + '/manage')
    159         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    160         # We can save the applicant
    161         self.fill_correct_values()
    162         self.browser.getControl(name="form.course1").value = ['CERT1']
    163         self.browser.getControl("Save").click()
    164         self.assertMatches('...Form has been saved...', self.browser.contents)
    165         self.assertFalse('Employer' in self.browser.contents)
    166         self.browser.open(self.ugapplicant_path + '/edit')
    167         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    168         self.assertFalse('Employer' in self.browser.contents)
    169         self.browser.open(self.ugapplicant_path + '/application_slip.pdf')
    170         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    171         return
    172123
    173124    def test_application_payment(self):
     
    195146        self.assertEqual(payment.amount_auth, 200.0)
    196147
    197         # PG applicants pay more
    198         self.browser.open(self.pgapplicant_path)
    199         self.browser.open(self.pgapplicant_path + '/manage')
    200         self.assertEqual(self.browser.headers['Status'], '200 Ok')
     148        return
     149
     150    def test_create_ugstudent(self):
     151        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     152        manage_path = 'http://localhost/app/applicants/%s/%s/%s' % (
     153            'app2011', self.ugapplicant.application_number, 'manage')
     154        self.browser.open(manage_path)
    201155        self.fill_correct_values()
    202         self.browser.getControl(name="form.course1").value = ['CERT2']
    203         self.browser.getControl(name="form.reg_number").value = '2345'
    204         self.browser.getControl(name="form.firstname").value = 'Anna'
    205         self.browser.getControl("Save").click()
    206         self.assertMatches('...Form has been saved...', self.browser.contents)
    207         self.browser.getControl("Add online payment ticket").click()
    208         self.assertMatches('...Payment ticket created...',
    209                            self.browser.contents)
    210         self.assertMatches('...Amount Authorized...',
    211                            self.browser.contents)
    212         payment_id = self.pgapplicant.keys()[0]
    213         payment = self.pgapplicant[payment_id]
    214         self.assertEqual(payment.p_item,'This is the pgft2011 container')
    215         self.assertEqual(payment.p_session,2011)
    216         self.assertEqual(payment.p_category,'application')
    217         self.assertEqual(payment.amount_auth, 300.0)
     156        self.browser.getControl("Save").click()
     157        IWorkflowState(self.ugapplicant).setState('admitted')
     158        self.browser.getControl(name="form.course1").value = ['CERT1']
     159        self.browser.getControl(name="form.course_admitted").value = ['CERT1']
     160        self.browser.getControl("Save").click()
     161        self.browser.getLink("Create student").click()
     162        student_id =  self.app['students'].keys()[0]
     163        self.assertTrue(('Student %s created' % student_id)
     164            in self.browser.contents)
     165        student = self.app['students'][student_id]
     166        self.assertEqual(student.email, 'xx@yy.zz')
     167        self.assertEqual(student.firstname, 'John')
     168        self.assertEqual(student.lastname, 'Tester')
     169        # Also additional attributes have been copied.
     170        self.assertEqual(student.lga, 'foreigner')
     171        self.assertEqual(student.nationality, 'NG')
    218172        return
    219173
  • main/waeup.fceokene/trunk/src/waeup/fceokene/utils/utils.py

    r8572 r8671  
    181181        'basic': 'PUTME, PDE, PCE, PRENCE',
    182182        'no': 'no application',
    183         'pg_ft': 'Postgraduate Full-Time',
    184         'pg_pt': 'Postgraduate Part-Time',
    185183        'sandwich': 'Sandwich',
    186184        'cest': 'Part-Time, Diploma, Certificate'
Note: See TracChangeset for help on using the changeset viewer.