Testing the flexible user registration
======================================

    >>> browser = self.browser

Check that the site admin has a link to the configlet in the control panel.
    
    >>> browser.open('http://nohost/plone/login_form')
    >>> browser.getControl('Login Name').value = 'admin'
    >>> browser.getControl('Password').value = 'secret'
    >>> browser.getControl('Log in').click()
    >>> browser.open('http://nohost/plone/plone_control_panel')
    >>> browser.getLink('Users and Groups').click()
    >>> 'Member Registration' in browser.contents
    True
    >>> link = browser.getLink(url='http://nohost/plone/@@member-registration')
    >>> link
    <Link ...>
    >>> link.click()
    >>> 'Registration settings' in browser.contents
    True

"Location" and "Home page" are not in the form by default.
    
    >>> form = browser.getForm(action='http://nohost/plone/@@member-registration')
    >>> join_form_fields = form.getControl(name='form.join_form_fields.to')
    >>> 'location' in join_form_fields.displayOptions
    False
    >>> 'home_page' in join_form_fields.displayOptions
    False

Let's add home_page to the list of join_form fields.
(Setting this by hand since add/remove widget doesn't work properly without javascript)
    >>> portal.portal_properties.site_properties._updateProperty('join_form_fields', ['fullname', 'username', 'email', 'password', 'home_page'])

It should show up at the end of the form.
    >>> browser.open('http://nohost/plone/@@join_form')
    >>> browser.contents
    '...User Name...Home page...'
    
Check that 'home_page' is now in the right box (enabled join_form fields).

    >>> browser.open('http://nohost/plone/@@member-registration')
    >>> form = browser.getForm(action='http://nohost/plone/@@member-registration')
    >>> enabled_fields = form.getControl(name='form.join_form_fields.to')
    >>> 'home_page' in enabled_fields.displayOptions
    True

Log out. Assert that we now have the home_page in the join form.

    >>> browser.getLink(url='http://nohost/plone/logout').click()
    >>> 'Log in' in browser.contents
    True
    >>> browser.open('http://nohost/plone/@@join_form')
    >>> 'Registration Form' in browser.contents
    True
    >>> 'Home page' in browser.contents
    True

Rearrange the fields
(Setting this by hand since add/remove widget doesn't work properly without javascript)
    >>> portal.portal_properties.site_properties._updateProperty('join_form_fields', ['fullname', 'username', 'password', 'home_page', 'email'])
    >>> browser.open('http://nohost/plone/@@join_form')
    >>> browser.contents
    '...Home page...E-mail...'

Add the groups field
    >>> portal.portal_properties.site_properties._updateProperty('join_form_fields', ['fullname', 'username', 'password', 'email', 'groups'])
    >>> browser.open('http://nohost/plone/@@join_form')
    >>> 'Add to the following groups' in browser.contents
    False
    
Log back in as admin. We should see it now.    
    >>> browser.open('http://nohost/plone/login_form')
    >>> browser.getControl('Login Name').value = 'admin'
    >>> browser.getControl('Password').value = 'secret'
    >>> browser.getControl('Log in').click()
    >>> browser.open('http://nohost/plone/@@join_form')
    >>> 'Add to the following groups' in browser.contents
    True
    
    