[Django] #31776: Django test client uses incomplete request for _login

6 views
Skip to first unread message

Django

unread,
Jul 10, 2020, 5:10:51 AM7/10/20
to django-...@googlegroups.com
#31776: Django test client uses incomplete request for _login
---------------------------------------------+------------------------
Reporter: Tiemo | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 3.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
---------------------------------------------+------------------------
The test client (django.test.client.Client) uses an empty request when
calling login. This is a little annoying when you have a
user_logged_(in|out) signal handler that attempts to retrieve the
request's IP for logging purposes.

The offending line [1] creates an empty HttpRequest. Perhaps it could use
RequestFactory.request instead?

[1]:
https://github.com/django/django/blob/master/django/test/client.py#L615

--
Ticket URL: <https://code.djangoproject.com/ticket/31776>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 10, 2020, 5:20:16 AM7/10/20
to django-...@googlegroups.com
#31776: Django test client uses incomplete request for _login
-----------------------------------+--------------------------------------
Reporter: Tiemo | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 3.0
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => duplicate
* easy: 1 => 0


Comment:

Duplicate of #15179.

--
Ticket URL: <https://code.djangoproject.com/ticket/31776#comment:1>

Reply all
Reply to author
Forward
0 new messages