WAeUP portal authentication
***************************

:Test-Layer: functional

We need to protect most pieces of our portals from unauthenticated
access.

Therefore users have to login to access main functionality and they
are able to log out afterwards.

Before we can check access we have to create an app:

  >>> from waeup.app import University
  >>> root = getRootFolder()
  >>> u = University()
  >>> root['app'] = u

To make sure, we can 'watch' pages, we first have to initialize our
test browser:

  >>> from zope.testbrowser.testing import Browser
  >>> browser = Browser()
  >>> browser.handleErrors = False

Accessing the front page
========================

We can access the front page without restrictions:

  >>> browser.open('http://localhost/app')
  >>> print browser.headers['Status']
  200 Ok

There is a login form on the fron page sidebar:

  >>> 'form.login' in browser.contents
  True

We use this form:

  >>> browser.getControl(name='form.login').value = 'grok'
  >>> browser.getControl(name='form.password').value = 'grok'
  >>> browser.getControl('Login').click()
