Ignore:
Timestamp:
5 Jun 2012, 15:07:26 (12 years ago)
Author:
Henrik Bettermann
Message:

Customize CustomApplicantRegistrationPage?.

Uniben applicants do see the login credentials on registration landing page.

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

Legend:

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

    r8569 r8630  
    186186            mapping = {'a':tcode}))
    187187        return note
     188
     189class CustomApplicantRegistrationPage(ApplicantRegistrationPage):
     190    """Captcha'd registration page for applicants.
     191    """
     192
     193    def _redirect(self, email, password, applicant_id):
     194        # Forward only email and credentials to landing page.
     195        self.redirect(self.url(self.context, 'registration_complete',
     196            data = dict(email=email, password=password,
     197            applicant_id=applicant_id)))
     198        return
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests.py

    r8622 r8630  
    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
     
    7982        self.app['applicants']['app2011'] = self.ugcontainer
    8083
     84        self.ugcontainer.mode = 'update'
     85        delta = datetime.timedelta(days=10)
     86        self.ugcontainer.startdate = datetime.datetime.now(pytz.utc) - delta
     87        self.ugcontainer.enddate = datetime.datetime.now(pytz.utc) + delta
     88
    8189        # Populate university
    8290        self.certificate = createObject('waeup.Certificate')
     
    216224        self.assertEqual(payment.p_category,'application')
    217225        self.assertEqual(payment.amount_auth, 300.0)
     226        return
     227
     228    def test_register_applicant_update(self):
     229        # An applicant can register himself.
     230        self.ugapplicant.reg_number = u'1234'
     231        notify(grok.ObjectModifiedEvent(self.ugapplicant))
     232        self.browser.open('http://localhost/app/applicants/app2011/')
     233        self.browser.getLink("Register for application").click()
     234        # Fill the edit form with suitable values
     235        self.browser.getControl(name="form.firstname").value = 'Klaus'
     236        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     237        self.browser.getControl(name="form.reg_number").value = '1234'
     238        self.browser.getControl("Get login credentials").click()
     239        self.assertMatches('...Your registration was successful...',
     240            self.browser.contents)
     241        self.assertMatches('...<td>Password:</td>...',
     242            self.browser.contents)
     243        # The new applicant can be found in the catalog via the email address
     244        cat = getUtility(ICatalog, name='applicants_catalog')
     245        results = list(
     246            cat.searchResults(email=('xx@yy.zz', 'xx@yy.zz')))
     247        applicant = results[0]
     248        self.assertEqual(applicant.lastname,'Under')
     249        # The applicant can be found in the catalog via the reg_number
     250        results = list(
     251            cat.searchResults(
     252            reg_number=(applicant.reg_number, applicant.reg_number)))
     253        self.assertEqual(applicant,results[0])
    218254        return
    219255
Note: See TracChangeset for help on using the changeset viewer.