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

Copy also customized fields from applicant to student.

Fix typos.

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

Legend:

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

    r8530 r8668  
    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.uniben/trunk/src/waeup/uniben/applicants/browser.py

    r8630 r8668  
    192192
    193193    def _redirect(self, email, password, applicant_id):
    194         # Forward only email and credentials to landing page.
     194        # Forward email and credentials to landing page.
    195195        self.redirect(self.url(self.context, 'registration_complete',
    196196            data = dict(email=email, password=password,
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/interfaces.py

    r8646 r8668  
    312312
    313313    def createStudent():
    314         """Create a student object from applicatnt data
     314        """Create a student object from applicant data
    315315        and copy applicant object.
    316316        """
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests.py

    r8630 r8668  
    2929from zope.catalog.interfaces import ICatalog
    3030from zope.testbrowser.testing import Browser
     31from hurry.workflow.interfaces import IWorkflowState
    3132from waeup.kofa.app import University
    3233from waeup.kofa.university.faculty import Faculty
     
    9394        self.certificate.start_level = 100
    9495        self.certificate.end_level = 500
     96        self.certificate.study_mode = u'ug_ft'
    9597        self.app['faculties']['fac1'] = Faculty()
    9698        self.app['faculties']['fac1']['dep1'] = Department()
     
    102104        self.certificate2.start_level = 100
    103105        self.certificate2.end_level = 500
     106        self.certificate.study_mode = u'pg_ft'
    104107        self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
    105108            self.certificate2)
     
    141144        self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'
    142145        self.browser.getControl(name="form.lga").value = ['foreigner']
     146        self.browser.getControl(name="form.nationality").value = ['NG']
    143147        self.browser.getControl(name="form.sex").value = ['m']
    144148        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     
    252256            reg_number=(applicant.reg_number, applicant.reg_number)))
    253257        self.assertEqual(applicant,results[0])
     258        return
     259
     260    def test_create_ugstudent(self):
     261        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     262        manage_path = 'http://localhost/app/applicants/%s/%s/%s' % (
     263            'app2011', self.ugapplicant.application_number, 'manage')
     264        self.browser.open(manage_path)
     265        self.fill_correct_values()
     266        self.browser.getControl("Save").click()
     267        IWorkflowState(self.ugapplicant).setState('admitted')
     268        self.browser.getControl(name="form.course1").value = ['CERT1']
     269        self.browser.getControl(name="form.course_admitted").value = ['CERT1']
     270        self.browser.getControl("Save").click()
     271        self.browser.getLink("Create student").click()
     272        student_id =  self.app['students'].keys()[0]
     273        self.assertTrue(('Student %s created' % student_id)
     274            in self.browser.contents)
     275        student = self.app['students'][student_id]
     276        self.assertEqual(student.email, 'xx@yy.zz')
     277        self.assertEqual(student.firstname, 'John')
     278        self.assertEqual(student.lastname, 'Tester')
     279        # Also additional attributes have been copied.
     280        self.assertEqual(student.lga, 'foreigner')
     281        self.assertEqual(student.nationality, 'NG')
    254282        return
    255283
Note: See TracChangeset for help on using the changeset viewer.