==============================
Adding recipes through the web
==============================

Let us take a browser and create a recipe folder:

  >>> from zope.testbrowser.testing import Browser
  >>> browser = Browser()
  >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
  >>> browser.open('http://localhost/@@contents.html')
  >>> browser.getControl(name='type_name').displayValue = [u'WorldCookery Site']
  >>> browser.getControl('Add').click()
  >>> browser.getControl(name='new_value').value = 'wcsite'
  >>> browser.getControl('Apply').click()
  >>> browser.getLink('wcsite').click()

  >>> browser.getControl(name='type_name').displayValue = [u'Recipe Folder']
  >>> browser.getControl('Add').click()
  >>> browser.getControl(name='new_value').value = 'recipes'
  >>> browser.getControl('Apply').click()
  >>> print browser.url
  http://localhost/wcsite/@@contents.html

In that recipe folder we will invoke the recipe add form:

  >>> link = browser.getLink('recipes')
  >>> print link.url
  http://localhost/wcsite/recipes/@@SelectedManagementView.html
  >>> link.click()
  >>> browser.getControl('Add', index=1).click()

In that form we fill all form elements with some typical recipe data:

  >>> browser.getControl('Name').value = 'Fish and Chips'
  >>> browser.getControl('Time to cook').value = '20'
  >>> browser.getControl('Description').value = \
  ...     "Fish and Chips is a typical British dish."

After filling the form we submit it by clicking the ``Add`` button:

  >>> browser.getControl('Add').click()

We have now been redirected to the containing folder.  Its *Contents*
listing now mentions our recipe:

  >>> print browser.url
  http://localhost/wcsite/recipes/@@contents.html
  >>> link = browser.getLink('Fish and Chips')
  >>> print link.url
  http://localhost/wcsite/recipes/Fish%20and%20Chips/@@SelectedManagementView.html  

We can also look at the recipe now and verify that the data we entered
above has been saved properly:

  >>> browser.open('http://localhost/wcsite/recipes/Fish and Chips')
  >>> '<h2>Fish And Chips</h2>' in browser.contents
  True
  >>> '20 mins' in browser.contents
  True
  >>> '<p>Fish and Chips is a typical British dish.</p>' in browser.contents
  True
