===============
Person add form
===============

Let's try to add a user:

    >>> from zope.testbrowser.testing import Browser
    >>> browser = Browser()
    >>> browser.addHeader('Authorization', 'Basic manager:schooltool')
    >>> browser.open('http://localhost/persons/@@add.html')

    >>> from schooltool.app.browser.ftests.setup import addPerson
    >>> addPerson('John Doe', 'jdoe', 'secret')
    >>> pc = getRootFolder()['persons']
    >>> 'jdoe' in pc
    True
    >>> person = pc['jdoe']
    >>> person.title
    u'John Doe'
    >>> person.username
    u'jdoe'
    >>> person.checkPassword('secret')
    True
    >>> person.photo is None
    True

If we try to add a user with the same login, we get a nice error message:

    >>> browser.open('http://localhost/persons/@@add.html')

    >>> browser.getControl('Full name').value = 'John Doe'
    >>> browser.getControl('Username').value = 'jdoe'
    >>> browser.getControl('Add').click()
    >>> 'This username is already used!' in browser.contents
    True


