#35851: django.test.client.ClientMixin._login doest not set enviorn like
REMOTE_ADDR can cause test failures in certain situations
------------------------+---------------------------------------------
Reporter: elonzh | Type: Bug
Status: new | Component: Testing framework
Version: | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+---------------------------------------------
Our service listens for the ''user_logged_in'' signal to log the user's IP
information, but when using ''TestClient.login/force_login'', the absence
of ''REMOTE_ADDR'' results in an error.
By reviewing the source code, I found that
''TestClient.login/force_login''(https://github.com/django/django/blob/main/django/test/client.py#L869-L882)
creates an empty HttpRequest, which behaves differently from
''django.test.client.Client.request''(https://github.com/django/django/blob/main/django/test/client.py#L401-L436).
Therefore, I believe this is an issue that needs to be addressed.
--
Ticket URL: <https://code.djangoproject.com/ticket/35851>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701929f61a184-c58ce042-b308-4159-a0bb-4257b6f42eb8-000000%40eu-central-1.amazonses.com.