summaryrefslogtreecommitdiff
path: root/django/test/client.py
AgeCommit message (Collapse)Author
2026-04-07Fixed CVE-2026-3902 -- Ignored headers with underscores in ASGIRequest.Jacob Walls
Thanks Tarek Nakkouch for the report and Jake Howard and Natalia Bidart for reviews.
2026-03-13Fixed #36966 -- Fixed ValueError when `query_params` and `follow` are used ↵Marc Gibbons
on test client.
2025-07-23Refs #36500 -- Shortened some long docstrings and comments.Mike Edmunds
Manually reformatted some long docstrings and comments that would be damaged by the to-be-applied autofixer script, in cases where editorial judgment seemed necessary for style or wording changes.
2025-07-23Removed double spaces after periods and within phrases.Sarah Boyce
2025-01-03Fixed #35414 -- Used default headers in AsyncRequestFactory.YashRaj1506
2024-10-16Refs #35727 -- Updated response.content.decode calls to use the ↵SaJH
HttpResponse.text property. Signed-off-by: SaJH <wogur981208@gmail.com>
2024-05-29Fixed 35467 -- Replaced urlparse with urlsplit where appropriate.Jake Howard
This work should not generate any change of functionality, and `urlsplit` is approximately 6x faster. Most use cases of `urlparse` didn't touch the path, so they can be converted to `urlsplit` without any issue. Most of those which do use `.path`, simply parse the URL, mutate the querystring, then put them back together, which is also fine (so long as urlunsplit is used).
2024-05-03Refs #31224 -- Fixed typo in django/test/client.py.Natalia
2024-03-13Fixed #34901 -- Added async-compatible interface to session engines.Jon Janzen
Thanks Andrew-Chen-Wang for the initial implementation which was posted to the Django forum thread about asyncifying contrib modules.
2023-11-24Fixed #34983 -- Deprecated django.utils.itercompat.is_iterable().Nick Pope
2023-11-23Fixed #14611 -- Added query_params argument to RequestFactory and Client ↵Tom Carrick
classes.
2023-10-31Fixed #32106 -- Preserved HTTP_HOST in test Client when following redirects.Ben Cail
Co-authored-by: David Sanders <shang.xiao.sanders@gmail.com>
2023-08-30Fixed #34757 -- Added support for following redirects to AsyncClient.Olivier Tabone
2023-08-24Corrected AsyncRequestFactory's docstring.Mariusz Felisiak
All AsyncRequestFactory methods are still synchronous callables.
2023-08-23Refs #34757 -- Moved HTTP redirect logic to django.test.client.ClientMixin.Olivier Tabone
2023-06-27Fixed #34391 -- Added async-compatible interface to auth functions and ↵Jon Janzen
related methods test clients.
2023-03-07Fixed #32172 -- Adapted signals to allow async handlers.Jon Janzen
co-authored-by: kozzztik <kozzztik@mail.ru> co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2023-02-17Fixed #34342, Refs #33735 -- Fixed test client handling of async streaming ↵Alexandre Spaeth
responses. Bug in 0bd2c0c9015b53c41394a1c0989afbfd94dc2830. Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
2023-01-13Fixed #34240 -- Preserved headers of requests made with django.test.Client ↵Mariusz Felisiak
in assertRedirects(). Bug in 67da22f08e05018ea968fcacbac9ac37ea925d85.
2023-01-05Refs #33865 -- Improved implementation of FakePayload.Nick Pope
FakePayload is a wrapper around io.BytesIO and is expected to masquerade as though it is a file-like object. For that reason it makes sense that it should inherit the correct signatures from io.BytesIO methods. Crucially an implementation of .readline() is added which will be necessary for this to behave more like the expected file-like objects as LimitedStream will be changed to defer to the wrapped stream object rather than rolling its own implementation for improved performance. It should be safe to adjust these signatures because FakePayload is only used internally within test client helpers, is undocumented, and thus private.
2022-11-14Fixed #34074 -- Added headers argument to RequestFactory and Client classes.David Wobrock
2022-11-10Updated documentation and comments for RFC updates.Nick Pope
- Updated references to RFC 1123 to RFC 5322 - Only partial as RFC 5322 sort of sub-references RFC 1123. - Updated references to RFC 2388 to RFC 7578 - Except RFC 2388 Section 5.3 which has no equivalent. - Updated references to RFC 2396 to RFC 3986 - Updated references to RFC 2616 to RFC 9110 - Updated references to RFC 3066 to RFC 5646 - Updated references to RFC 7230 to RFC 9112 - Updated references to RFC 7231 to RFC 9110 - Updated references to RFC 7232 to RFC 9110 - Updated references to RFC 7234 to RFC 9111 - Tidied up style of text when referring to RFC documents
2022-11-08Fixed #34063 -- Fixed reading request body with async request factory and ↵Scott Halgrim
client. Co-authored-by: Kevan Swanberg <kevswanberg@gmail.com> Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2022-06-09Fixed #33755 -- Moved ASGI body-file cleanup into request class.Jonas Lundberg
2022-03-08Rewrote some references to "master".Adam Johnson
Following d9a266d657f66b8c4fa068408002a4e3709ee669.
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-02-03Refs #33476 -- Refactored problematic code before reformatting by Black.Mariusz Felisiak
In these cases Black produces unexpected results, e.g. def make_random_password( self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789', ): or cursor.execute(""" SELECT ... """, [table name], )
2022-01-07Fixed #28628 -- Changed \d to [0-9] in regexes where appropriate.Ad Timmering
2021-10-18Refs #32956 -- Changed docs to treat the acronym HTTP phonetically.David Smith
2021-09-24Fixed #33132 -- Fixed test client handling of querystring only redirects.Jaap Roes
Regression in 1e5aa8e1c79252cc810af21294a6e945d11d37b3.
2021-07-29Fixed 32956 -- Lowercased spelling of "web" and "web framework" where ↵David Smith
appropriate.
2021-07-15Fixed #32929 -- Fixed handling query strings in AsyncRequestFactory.pochangl
2021-06-23Fixed #32790 -- Ensured test Client handles redirects to domain indexes ↵tomhamiltonstubber
without a specified trailing slash.
2021-02-23Fixed #32470 -- Fixed ResolverMatch instance on test clients when ↵Marc Gibbons
request.urlconf is set.
2020-11-04Fixed #32159 -- Ensured AsyncRequestFactory correctly sets headers.Carlton Gibson
2020-11-03Fixed #32162 -- Fixed setting Content-Length header in AsyncRequestFactory.Patrick Arminio
2020-10-27Fixed #32128 -- Added asgiref 3.3 compatibility.Carlton Gibson
Thread sensitive parameter is True by default from asgiref v3.3.0. Added an explicit thread_sensitive=False to previously implicit uses.
2020-08-14Added missing items to django.test.client.__all__ and django.test.utils.__all__.Mads Jensen
2020-07-30Bumped minimum isort version to 5.1.0.David Smith
Fixed inner imports per isort 5. isort 5.0.0 to 5.1.0 was unstable.
2020-05-27Fixed #31494 -- Preserved query strings when following HTTP 307/308 ↵Ahmad A. Hussein
redirects in test client.
2020-05-11Refs #30116 -- Simplified regex match group access with Match.__getitem__().Jon Dufresne
The method has been available since Python 3.6. The shorter syntax is also marginally faster.
2020-03-18Fixed #31224 -- Added support for asynchronous views and middleware.Andrew Godwin
This implements support for asynchronous views, asynchronous tests, asynchronous middleware, and an asynchronous test client.
2019-11-19Removed unnecessary numeric indexes in format strings.Jon Dufresne
2019-10-29Fixed #30899 -- Lazily compiled import time regular expressions.Hasan Ramezani
2019-10-18Fixed #28337 -- Preserved extra headers of requests made with ↵Patrick Jenkins
django.test.Client in assertRedirects(). Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
2019-08-11Fixed #30677 -- Improved error message for urlencode() and Client when None ↵swatantra
is passed as data.
2019-06-17Fixed typos in FakePayload docstring and SimplifiedURLTests test name.Min ho Kim
2019-06-07Fixed #30550 -- Fixed decoding of non-UTF-8 bytes objects in response.json().Jon Dufresne
2019-03-11Minimized try block in Client.request().Jon Dufresne