@Malcolm, Sorry It should be some bad pastes :(

Finally, I have solved the problem using the following 2 lines:

c = Client()
c.login(username='alex...@e.com', password='alex')

In fact, I can't login in with the following code
self.client.login(username='alex...@e.com', password='alex')

I don't know why. So if anyone knows the reason, why not share it without us
:)

Xinlei

On 7 September 2011 16:44, Malcolm Box <malcolm....@gmail.com> wrote:

> On 7 September 2011 11:52, MATHIEU <chenxinlei12345...@gmail.com> wrote:
>
>> For the GET method, I have tried the following code:
>> ================================
>>    def test_patron_phone_get_form(self):
>>            self.client.login(usernamer='alex...@e.com',
>> password='alex')
>>            response = self.client.get(reverse('patron_edit_phone'))
>>            self.assertEquals(response.status_code, 200)
>> ================================
>> But this doesn't work. Instead of getting a status_code=200, I get a
>> status_code=302. Why?
>>
>
> If this is a cut'n'paste of your code, you have a typo in the
> self.client.login() call - you're passing "usernamer" not "username"
>
> Malcolm
>
> --
> 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.
>

-- 
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.

Reply via email to