Reputation: 83788
What's the correct procedure to check in the functional test case whether or not the page is accessible by the currently logged in user?
Please point a working example :)
Upvotes: 2
Views: 210
Reputation: 5742
>>> browser.handleErrors = False
>>> browser.open(unauthorized_url)
Traceback (most recent call last):
Unauthorized: ...
Upvotes: 3
Reputation: 13105
To check if the page IS accessible is easy. You typically do
browser.open(url)
and check for something in browser.contents.
To make sure the page is inaccessible and for instance raises, you could import HTTPError
from urllib2 import HTTPError
obtain a browser instance, login with it, and do
self.assertRaises(HTTPError, browser.open, url)
Upvotes: 3