Functional doctests for creating different resources
====================================================

This test shows how different types of resources can be created and accessed
through the browser.

Set up
------

    >>> from zope.testbrowser.testing import Browser
    >>> manager = Browser()
    >>> manager.addHeader('Authorization', 'Basic manager:schooltool')
    >>> manager.handleErrors = False
    >>> manager.open('http://localhost/')

Creating Resources
------------------

We can create generic resources

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('Resources').click()

    >>> manager.getLink('New Resource').click()
    >>> manager.getControl('Title').value = 'Book'
    >>> manager.getControl('Add').click()
    >>> manager.getLink('Resource', index=2).click()
    >>> 'Book' in manager.contents
    True

We can create Location resources, which also have a capacity option

    >>> manager.getLink('New Location').click()
    >>> manager.getControl('Title').value = 'Room 101'
    >>> manager.getControl(name='field.type.newSubType').value = 'class room'
    >>> manager.getControl('Type').value = ['']
    >>> manager.getControl('Capacity').value = '10'
    >>> manager.getControl('Add').click()
    >>> manager.getLink('class room').click()
    >>> 'Room 101' in manager.contents
    True

We can create Equipment resources also:

    >>> manager.getLink('New Equipment').click()
    >>> manager.getControl('Title').value = 'Projector 1'
    >>> manager.getControl(name='field.type.newSubType').value = 'Projector'
    >>> manager.getControl('Manufacturer').value = 'Sony'
    >>> manager.getControl('Model').value = 'RS-1'
    >>> manager.getControl('Serial Number').value = 'ABC123-987'
    >>> manager.getControl('Purchase Date') != None
    True
    >>> manager.getControl('Add').click()
    >>> manager.getLink('Projector').click()
    >>> 'Projector 1' in manager.contents
    True

If we go back and add more resources that have type fields, then we
can choose an existing type from a drop down box.

    >>> manager.getLink('New Equipment').click()
    >>> manager.getControl('Title').value = 'Projector 2'
    >>> manager.getControl('Type').value = ['Projector']
    >>> manager.getControl('Manufacturer').value = 'Sony'
    >>> manager.getControl('Model').value = 'RS-1'
    >>> manager.getControl('Serial Number').value = 'ABC123-9876'
    >>> manager.getControl('Purchase Date') != None
    True
    >>> manager.getControl('Add').click()
    >>> manager.getLink('Projector').click()
    >>> 'Projector 2' in manager.contents
    True
