Ignore:
Timestamp:
3 Apr 2012, 20:40:17 (13 years ago)
Author:
Henrik Bettermann
Message:

Define two different application modes: create and update. The latter expects existing (imported) application records. The ApplicantRegistrationPage? renders different form fields and creates or updates application records depending on the selected mode.

The update registration mode is not yet secure enough. Further security features will be added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r8008 r8033  
    8484        applicantscontainer.entry_level = 100
    8585        applicantscontainer.application_category = 'basic'
     86        applicantscontainer.mode = 'create'
    8687        delta = timedelta(days=10)
    8788        applicantscontainer.startdate = date.today() - delta
     
    248249        self.browser.getControl(name="form.year").value = ['2010']
    249250        self.browser.getControl(name="form.entry_level").value = ['100']
     251        self.browser.getControl(name="form.mode").value = ['create']
    250252        self.browser.getControl(
    251253            name="form.application_category").value = ['basic']
     
    262264        self.browser.getControl(name="form.year").value = ['2010']
    263265        self.browser.getControl(name="form.entry_level").value = ['100']
     266        self.browser.getControl(name="form.mode").value = ['create']
    264267        self.browser.getControl(
    265268            name="form.application_category").value = ['basic']
     
    276279        self.browser.getControl(name="form.year").value = ['2010']
    277280        self.browser.getControl(name="form.entry_level").value = ['100']
     281        self.browser.getControl(name="form.mode").value = ['create']
    278282        #self.browser.getControl(name="form.ac_prefix").value = ['APP']
    279283        self.browser.getControl(
     
    788792    layer = FunctionalLayer
    789793
    790     def test_register_applicant(self):
     794    def test_register_applicant_create(self):
    791795        # An applicant can register himself.
    792796        self.browser.open(self.container_path)
     
    802806        self.assertEqual(self.browser.url,
    803807            self.container_path + '/registration_complete?email=xx%40yy.zz')
     808        # Now we change the application mode and check if applicants
     809        # can find and update imported records instead of creating new records.
     810        # First we check what happens if record can't be found.
     811        self.applicantscontainer.mode = 'update'
     812        self.browser.open(self.container_path + '/register')
     813        #self.browser.getControl(name="form.firstname").value = 'John'
     814        self.browser.getControl(name="form.reg_number").value = 'anynumber'
     815        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     816        self.browser.getControl("Get login credentials").click()
     817        self.assertTrue('No application record found.'
     818            in self.browser.contents)
     819        # Now we check if password has already been set.
     820        #self.browser.getControl(name="form.firstname").value = 'John'
     821        self.browser.getControl(name="form.reg_number").value = '1234'
     822        self.browser.getControl("Get login credentials").click()
     823        self.assertTrue('Your password has already been set.'
     824            in self.browser.contents)
     825        # We unset the password and try to register again.
     826        IUserAccount(
     827            self.app['applicants']['app2009'][
     828            self.applicant.application_number]).context.password = None
     829        self.browser.open(self.container_path + '/register')
     830        #self.browser.getControl(name="form.firstname").value = 'John'
     831        self.browser.getControl(name="form.reg_number").value = '1234'
     832        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     833        self.browser.getControl("Get login credentials").click()
     834        self.assertTrue('Your registration was successful.'
     835            in self.browser.contents)
    804836        return
    805837
Note: See TracChangeset for help on using the changeset viewer.