to enhance massimo's response, you can test the HTTP status code in the 
except block:

    >>> try:
    ...   index()
    ... except HTTP, e:
    ...   assert(e.status == 400)
    ...   assert(e.body == "Not permitted")
    ...

Reply via email to