Favorite Views
--------------

Set up user.

    >>> uf = app.site.acl_users
    >>> _ignored = uf._doAddUser('mgr', 'mgrpw', ['Manager'], [])

Create the browser object we'll be using.

    # BBB for Zope 2.12
    >>> try:
    ...     from Testing.testbrowser import Browser
    ... except ImportError:
    ...     from Products.Five.testbrowser import Browser

    >>> browser = Browser()
    >>> browser.handleErrors = False
    >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')

Use the add form without input.

    >>> browser.open('http://localhost/site/++add++Favorite')
    >>> '[[cmf_default][Add [[cmf_default][Favorite]]]]' in browser.contents
    True
    >>> browser.getControl('[[zope][Add]]').click()
    >>> '[[zope][There were errors]]' in browser.contents
    True
    >>> '[[zope][Required input is missing.]]' in browser.contents
    True

Use the add form with valid input.

    >>> browser.open('http://localhost/site/++add++Favorite')
    >>> '[[cmf_default][Add [[cmf_default][Favorite]]]]' in browser.contents
    True
    >>> browser.getControl(name='form.id').value = 'myFavorite'
    >>> browser.getControl(name='form.title').value = 'FAVORITE TITLE'
    >>> browser.getControl(name='form.description').value = 'FAVORITE DESCRIPTION.'
    >>> browser.getControl(name='form.remote_url').value = 'PATH/TO/ITEM'
    >>> browser.getControl('[[zope][Add]]').click()
    >>> '[[cmf_default][[[cmf_default][Favorite]] added.]]' in browser.contents
    True

Use the edit form without input.

    >>> browser.open('http://localhost/site/myFavorite/@@edit.html')
    >>> '[[cmf_default][Edit [[cmf_default][Favorite]]]]' in browser.contents
    True
    >>> browser.getControl('[[cmf_default][Change]]').click()
    >>> '[[cmf_default][Nothing to change.]]' in browser.contents
    True

Use the edit form with valid input.

    >>> browser.open('http://localhost/site/myFavorite/@@edit.html')
    >>> '[[cmf_default][Edit [[cmf_default][Favorite]]]]' in browser.contents
    True
    >>> browser.getControl(name='form.remote_url').value = 'PATH/TO/OTHER'
    >>> browser.getControl('[[cmf_default][Change]]').click()
    >>> '[[cmf_default][[[cmf_default][Favorite]] changed.]]' in browser.contents
    True
