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

See waeup.uniben.

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

Legend:

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

    r8532 r8669  
    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.aaue/trunk/src/waeup/aaue/applicants/tests.py

    r8623 r8669  
    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
     
    7983        self.app['applicants']['app2011'] = self.ugcontainer
    8084
     85        self.ugcontainer.mode = 'update'
     86        delta = datetime.timedelta(days=10)
     87        self.ugcontainer.startdate = datetime.datetime.now(pytz.utc) - delta
     88        self.ugcontainer.enddate = datetime.datetime.now(pytz.utc) + delta
     89
    8190        # Populate university
    8291        self.certificate = createObject('waeup.Certificate')
     
    8594        self.certificate.start_level = 100
    8695        self.certificate.end_level = 500
     96        self.certificate.study_mode = u'ug_ft'
    8797        self.app['faculties']['fac1'] = Faculty()
    8898        self.app['faculties']['fac1']['dep1'] = Department()
     
    94104        self.certificate2.start_level = 100
    95105        self.certificate2.end_level = 500
     106        self.certificate.study_mode = u'pg_ft'
    96107        self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
    97108            self.certificate2)
     
    133144        self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'
    134145        self.browser.getControl(name="form.lga").value = ['foreigner']
     146        self.browser.getControl(name="form.nationality").value = ['NG']
    135147        self.browser.getControl(name="form.sex").value = ['m']
    136148        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     
    216228        self.assertEqual(payment.p_category,'application')
    217229        self.assertEqual(payment.amount_auth, 300.0)
     230        return
     231
     232    def test_create_ugstudent(self):
     233        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     234        manage_path = 'http://localhost/app/applicants/%s/%s/%s' % (
     235            'app2011', self.ugapplicant.application_number, 'manage')
     236        self.browser.open(manage_path)
     237        self.fill_correct_values()
     238        self.browser.getControl("Save").click()
     239        IWorkflowState(self.ugapplicant).setState('admitted')
     240        self.browser.getControl(name="form.course1").value = ['CERT1']
     241        self.browser.getControl(name="form.course_admitted").value = ['CERT1']
     242        self.browser.getControl("Save").click()
     243        self.browser.getLink("Create student").click()
     244        student_id =  self.app['students'].keys()[0]
     245        self.assertTrue(('Student %s created' % student_id)
     246            in self.browser.contents)
     247        student = self.app['students'][student_id]
     248        self.assertEqual(student.email, 'xx@yy.zz')
     249        self.assertEqual(student.firstname, 'John')
     250        self.assertEqual(student.lastname, 'Tester')
     251        # Also additional attributes have been copied.
     252        self.assertEqual(student.lga, 'foreigner')
     253        self.assertEqual(student.nationality, 'NG')
    218254        return
    219255
Note: See TracChangeset for help on using the changeset viewer.