#15179: django.test.client.Client.login fake HttpRequest is not run through
middlewares
-------------------------------------+-------------------------------------
Reporter: Ciantic | Owner:
Type: Bug | unaizalakain
Component: Testing framework | Status: assigned
Severity: Normal | Version: master
Keywords: | Resolution:
Has patch: 1 | Triage Stage: Accepted
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by unaizalakain):
It's kind of messy but all the `get`, `post`, etc. go through middleware.
This methods all call the `self.generic` method which in turn calls the
`self.request` method. Now, this method doesn't do a big thing in
`RequestFactory` but it's subclassed in `Client` and makes use of
`self.handler` which builds the request through middleware.
Now, the `self.request` returns directly a response and in `login` and
`logout` we need the source request also. I thought about returning
`(request, response)` tuples in `self.request` but that wouldn't be
backwards compatible so I directly call `self.handler` witch returns me
the source request attached.
Now that I think it, if `self.handler` attaches the source request, I
could also get it (I think) through `self.request`. Gonna look into it.
--
Ticket URL: <https://code.djangoproject.com/ticket/15179#comment:20>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.976ea4804f2c90254a04df8e155f8d71%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.