The waeup package
********************
:Test-Layer: functional
University
==========
We can watch universities in the browser.
To make sure, we can 'watch' pages, we first have to initialize out
test browser::
>>> from zope.testbrowser.testing import Browser
>>> browser = Browser()
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
>>> browser.handleErrors = False
We create an university object and put into the ZODB root::
>>> root = getRootFolder()
>>> list(root)
[]
>>> from waeup.app import University
>>> u = University()
>>> root['myuniversity'] = u
>>> list(root)
[u'myuniversity']
Let's get the default view of a university::
>>> browser.open('http://localhost/myuniversity')
>>> print browser.contents
>> browser.open('http://localhost/myuniversity/manage')
>>> print browser.contents
>> 'Sample University' in browser.contents
True
We can export a university as XML::
>>> browser.open('http://localhost/myuniversity/export.xml')
>>> print browser.contents
...
>>> print browser.headers
Status: 200 Ok
Content-Length: ...
Content-Type: text/xml; charset=UTF-8
X-Powered-By: Zope (www.zope.org), Python (www.python.org)
Faculties
=========
Faculties are stored in a special container of `IUniversity`
instances. The container is called ``faculties`` and provides an
add-form to add new faculties::
>>> browser.open('http://localhost/myuniversity/faculties/add')
>>> print browser.contents
*Name of Faculty
...
We fill in a new name for our new faculty::
>>> ctrl = browser.getControl(name='form.title')
>>> ctrl.value = 'TestFac'
Furthermore we add a prefix and a code (kind of abbreviation):
>>> browser.getControl(name='form.code').value = 'TF'
Finally we click on 'Add Faculty' to add the new thing::
>>> browser.getControl('Add faculty').click()
We can view a faculty by browsing a URL like this::
>>> browser.open('http://localhost/myuniversity/faculties/0')
Afterwards, the faculty should be visible:
>>> browser.open('http://localhost/myuniversity/faculties')
>>> print browser.contents
Registered faculties:
...TestFac
...
Data Center
===========
The data center helps us uploading files for later import or similar.
>>> browser.open('http://localhost/myuniversity')
>>> browser.getLink('Data Center').click()
By default we have a directory in the sources for upload:
>>> print browser.contents
/.../waeup/files
...