Thursday, November 27, 2014

Re: Test client to a redirect requiring a login doesn't set redirect_chain properly?

On 2014-11-27 20:15, Tim Chase wrote:
> However my test fails with:
>
> AssertionError: Response redirected to
> 'http://testserver/admin/common/region/add/', expected
> 'http://testserver/accounts/login/?next=/admin/common/region/add/'
>
> Where am I going wrong? Do admin pages not have @login_required as
> I expect? Does the test-client not fully follow when follow=True?

As a bit of follow-up information, if I use runserver and browse to
the view, it redirects me to /admin/common/region/add/ but it
displays as the login screen. Am I missing why this wouldn't do a
redirect to my named login URL?

(this at least demonstrates that the test-client and browser/server
behavior is consistent; I'm just unsure why I'm not getting the login
url)

Thanks,

-tim



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20141127203236.094a6939%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment