All,
I have created a unit test for my web2py app.
I mainly followed this slice: http://ift.tt/1zvC1LM
I can register and login users with tests.
I cannot however get around the problem of testing the auth.requires_login() decorator.
I run tests that log the user in, i can see the resultant changes to the test db in auth_events and auth_users, but attempts to open the index function result in redirect.
When I run the test with the @auth decorator removed and put a simple if statement to check if a user exists i.e. that i logged a user in. This shows that a user exists and the auth object is visible to the function.
Any help would be great.
Aucun commentaire:
Enregistrer un commentaire