I've been looking that the unit testing page
(http://www.web2py.com/AlterEgo/default/show/260), which is very helpful.
However, most of my controller functions are decorated with
'@auth.requires_login()', and thus if I call them from the test suite,
they fail (issuing a redirect):

  File "/home/kae/hg/kae/web2py/gluon/tools.py", line 934, in <lambda>
    settings.on_failed_authentication = lambda x: redirect(x)
  File "/home/kae/hg/kae/web2py/gluon/http.py", line 128, in redirect
    Location=location)
HTTP: 303 SEE OTHER

One could argue that's a "correct" failure because the test suite isn't
authenticated, but I'd like to use unit tests to test functions that need
authentication. I don't want to test the authentication mechanism itself.

Is there a way to fake authentication to allow unit testing? Do others
have a better way of doing this?
-- 
"You can have everything in life you want if you help enough other people
get what they want" - Zig Ziglar. 

Who did you help today?

Reply via email to