> > I'm running into problems with the test client's login method.
> > Specifically, within a single test method, the first login succeeds but
> the
> > second one fails.
> > Is this something that should work ? Am I doing something wrong ?
> 
> The 'bool object has no attribute status_code' message is generated
> because the login() method visits the named url, and tries to fill in
> the form it finds. If you are already logged in, and you visit a
> login-decorated view, the login form won't be shown - the underlying
> content will be shown. The login() test method returns true because a
> user is already logged in.

Ahhh. So after I've used login() once in a test, get() will pass the
existing session cookie, in which case my test to retrieve two pages while
logged in would look like :
client.login(...)
client.get(...)
Does that sound right ? I'll try that later today.

> You should also be warned that revision [5152] (post 0.96 release)
> modified the login method to use the internal authentication plumbing,
> rather than using a login view. This will affect the way you write
> your tests using the login method, although you will probably still
> experience difficulties if you try to 'double login' like your test
> view is trying to do.

Yes, I saw that. Thanks for the warning, though.

Chris




--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to