Opened 4 years ago

Closed 4 years ago

#31776 closed Bug (duplicate)

Django test client uses incomplete request for _login

Reported by: Tiemo Owned by: nobody
Component: Testing framework Version: 3.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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

Change History (1)

comment:1 by Mariusz Felisiak, 4 years ago

Easy pickings: unset
Resolution: duplicate
Status: newclosed

Duplicate of #15179.

Note: See TracTickets for help on using tickets.
Back to Top