The article on Unit Test Controllers using unittest
(http://www.web2py.com/AlterEgo/default/show/213 )
 gives some examples on how to unit-test web2py controllers.

However, how do I test controller functions that are decorated with
auth.requires_login()? When I tried running a test similar to that of
the article, I got a:
NameError: name 'auth' is not defined

Ok, makes sense (although I was surprised that the model, in which
auth
is defined, is not auto-loaded).
I tried putting a
self.model = exec_environment('applications/myapp/models/db.py')
line before the
self.controller =
exec_environment('applications/myapp/controllers/default.py',
request=self.request)
but got an error:
SyntaxError: not enough information to build the url

So, what's the right way to test auth-protected controller functions?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to