Yes Rubén you are right,
also you can use directly self.client.login() method:
...
def setUp(self):login =
self.client.login(username='myusername', password='mypass')
self.assertTrue(login)
On Mon, Feb 6, 2012 at 12:46 PM, xina towner wrote:
> Hi, I've a question, how can I make login while testing? shouldn't be
> enough to do something like this:
>
> def setUp(self):
> response = self.post('/accounts/login/', {'username': 'username',
> 'password': 'username'})
> self.assertEqual(response.status_code, 200, "Login Failure")
> pass
>
> I understand that this setUp makes login before every test. Can you tell
> me if I am right?
>
> --
> Gràcies,
>
> Rubén
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
--
This e-mail and any file transmitted with it is intended only for the
person or entity to which is addressed and may contain information that is
privileged, confidential or otherwise protected from disclosure. Copying,
dissemination or use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you are not the
intended recipient, please notify the sender immediately by return e-mail,
delete this communication and destroy all copies.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.