login in testing – must call GET before doing POST

In 0.96, if you dive straight in with a POST to your login page with username/password, you’ll get a login error, saying “Your Web browser doesn’t appear to have cookies enabled. Cookies are required for logging in.”.

This is because the test cookie only gets set when you do a GET.

So doing this works:


response=client.get(login_page)
response=client.post(login_page, {'username': username, 'password': password, 'next': home_page})

But just doing the post doesn’t.

Leave a Reply