#14116: TestClient skips Csrf Middleware
-------------------------------+--------------------------------------------
Reporter: [email protected] | Owner: nobody
Status: new | Milestone:
Component: Testing framework | Version: 1.2
Keywords: TestClient | Stage: Unreviewed
Has_patch: 0 |
-------------------------------+--------------------------------------------
The following code is found in TestClient
{{{
try:
request = WSGIRequest(environ)
# sneaky little hack so that we can easily get round
# CsrfViewMiddleware. This makes life easier, and is probably
# required for backwards compatibility with external tests
against
# admin views.
request._dont_enforce_csrf_checks = True
response = self.get_response(request)
}}}
While this is nice, it makes the test behave in a way that does not really
verify the site works.
Some of my views are run when accessed from a desktop program, and the
desktop program does not send a CSRF token, resulting in a 403 Forbidden
error, but does not happen when a test is run because of the above code.
Can we get an option to turn this off?
Thanks.
--
Ticket URL: <http://code.djangoproject.com/ticket/14116>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.