Index: /waeup/branches/ulif-layout/src/waeup/browser.txt
===================================================================
--- /waeup/branches/ulif-layout/src/waeup/browser.txt	(revision 4758)
+++ /waeup/branches/ulif-layout/src/waeup/browser.txt	(revision 4759)
@@ -399,4 +399,157 @@
   >>> browser.open('http://localhost/myuniversity/faculties/TF/TD')
   >>> 'My renamed course' in browser.contents
+  False
+
+
+Certificates
+============
+
+Once we have a department, we can add also certificats.
+
+Adding certificates
+-------------------
+
+Certificates are stored in :class:`ICertificateContainer` instances
+with their code as key. CertificateContainers are normally availabe as
+`certificates` attribute of
+:class:`waeup.university.department.Department` instances.
+
+To ease the life of users we do not require to browse the
+certificatecontainers (which have in fact no user interface), but
+provide adding of certificates in department views.
+
+Each department provides a ``Add certificate`` action button near top.
+
+Departments provide an add-form to add new certificates:
+
+  >>> dept_url = 'http://localhost/myuniversity/faculties/TF/TD'
+  >>> browser.open(dept_url + '/addcertificate')
+  >>> print browser.contents
+  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
+  ...<span class="required">*</span><span>title</span>
+  ...
+
+We fill in a name for our new cert:
+
+  >>> ctrl = browser.getControl(name='form.title')
+  >>> ctrl.value = 'My Certificate 1'
+
+Furthermore we add a code (kind of abbreviation):
+
+  >>> browser.getControl(name='form.code').value = 'CERT1'
+
+Set the remaining required fields:
+
+  >>> browser.getControl(name='form.category').value = 'UME'
+  >>> browser.getControl(name='form.study_mode').value = 'combined'
+  >>> browser.getControl(name='form.start_level').value = '100'
+  >>> browser.getControl(name='form.end_level').value = '400'
+  >>> browser.getControl(name='form.application_category').value = 'UME'
+  >>> browser.getControl(name='form.m_prefix').value = 'something'
+  >>> browser.getControl(name='form.max_pass').value = '400'
+
+Finally, we create the certificate:
+
+  >>> browser.getControl('Add certificate').click()
+
+If we try to register a certificate under the same code twice we will
+get an error:
+
+  >>> browser.open(dept_url + '/addcertificate')
+  >>> ctrl = browser.getControl(name='form.title')
+  >>> ctrl.value = 'Another cert with same code'
+  >>> browser.getControl(name='form.code').value = 'CERT1'
+  >>> browser.getControl(name='form.category').value = 'UME'
+  >>> browser.getControl(name='form.study_mode').value = 'combined'
+  >>> browser.getControl(name='form.start_level').value = '100'
+  >>> browser.getControl(name='form.end_level').value = '400'
+  >>> browser.getControl(name='form.application_category').value = 'UME'
+  >>> browser.getControl(name='form.m_prefix').value = 'something'
+  >>> browser.getControl(name='form.max_pass').value = '400'
+
+  >>> browser.getControl('Add certificate').click()
+  >>> print browser.contents
+  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
+  ...<div>The name chosen already exists in the database</div>
+  ...
+
+Our certificate will be linked under the code on the department page:
+
+  >>> browser.open(dept_url)
+  >>> browser.getLink('CERT1').click()
+  >>> browser.url
+  'http://localhost/myuniversity/faculties/TF/TD/certificates/CERT1'
+
+Before we really add a certificate we can cancel the action and will be
+redirected to the department page:
+
+  >>> browser.open(dept_url + '/addcertificate')
+  >>> browser.getControl('Cancel').click()
+  >>> browser.url
+  'http://localhost/myuniversity/faculties/TF/TD'
+
+
+Modifying certificates
+----------------------
+
+We can change the settings for a cert by clicking on the provided
+'Edit settings' link:
+
+  >>> browser.open(dept_url + '/certificates/CERT1')
+  >>> browser.getLink('Edit settings').click()
+
+When modifying a certificate, we cannot change the code any more:
+
+  >>> browser.getControl(name='form.code')
+  Traceback (most recent call last):
+  ...
+  LookupError: name 'form.code'
+
+Let's set a new title and save the form:
+
+  >>> browser.getControl(name='form.title').value = "My test cert"
+  >>> browser.getControl(name='form.actions.save').click()
+
+Clicking 'Save' we will stay on the settings form. So we can change
+the cert again. This time we will return to the overview page
+afterwards:
+
+  >>> browser.getControl(name='form.title').value = "My renamed cert" 
+  >>> ctrl = browser.getControl("Save and return")
+  >>> ctrl.click()
+
+If we go to the settings page and click ``Cancel`` nothing will be
+changed:
+
+  >>> browser.getLink('Edit settings').click()
+  >>> browser.getControl(name='form.title').value = "Blah"
+  >>> browser.getControl('Cancel').click()
+
+Our certificate was indeed renamed to ``My renamed cert`` and not to
+``Blah``:
+
+  >>> browser.open('http://localhost/myuniversity/faculties/TF/TD')
+  >>> print browser.contents
+  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
+  ...<div name="thecerttable">
+  ...<td>My renamed cert</td>...
+  ...
+
+
+Deleting certificates
+---------------------
+
+We can delete certificates by browsing the containing department and
+clicking on the appropriate 'Delete' button. As we have only one
+certificate, there is only one 'Delete' button yet:
+
+  >>> browser.open('http://localhost/myuniversity/faculties/TF/TD')
+  >>> 'My renamed cert' in browser.contents
+  True
+
+  >>> browser.getControl('Delete').click()
+
+  >>> browser.open('http://localhost/myuniversity/faculties/TF/TD')
+  >>> 'My renamed cert' in browser.contents
   False
 
