Re: How to unit test if user has access to page

2011-04-17 Thread Pedro Kroger
Good point. Thank you guys! Pedro On Sat, Apr 16, 2011 at 2:15 PM, Martin Brochhaus wrote: > Also beware! Only do a client.post if you really want to test that a user > submits a form. Usually when a not-logged-in-user wants to go to a secured > page immediately he will try a get request and jus

Aw: How to unit test if user has access to page

2011-04-16 Thread Martin Brochhaus
Also beware! Only do a client.post if you really want to test that a user submits a form. Usually when a not-logged-in-user wants to go to a secured page immediately he will try a get request and just enter the URL. Sometimes your view behaves differently on get and on post (most of the times) s

Re: How to unit test if user has access to page

2011-04-15 Thread Javier Guerra Giraldez
On Fri, Apr 15, 2011 at 8:54 PM, Pedro Kroger wrote: > result = self.client.post('/dashboard/') > > But I don't know how to test if the result is the dashboard or the > login page. Could you guys point me in the right direction? from the docs (http://docs.djangoproject.com/en/1.3/topics/testing/

How to unit test if user has access to page

2011-04-15 Thread Pedro Kroger
Hi, I writing some unit tests and I'd like to test if an unlogged user has access to the main dashboard page. In my application, if the user is logged it will go to the dashboard, if it isn't, it will go to the login page. I know how to get to the webpage: result = self.client.post('/dashboard/')