summaryrefslogtreecommitdiff
path: root/tests/test_client/tests.py
AgeCommit message (Collapse)Author
2026-06-11Fixed #36837 -- Skipped backends not implementing (a)get_user() in ↵Sezer BOZKIR
(a)force_login(). Co-authored-by: Mykhailo Havelia <Arfey17.mg@gmail.com>
2026-05-13Fixed #35514 -- Implemented dictionary-based MAILERS.Mike Edmunds
See DEP 0018. Added: * MAILERS setting. * django.core.mail.mailers dict-like EmailBackend factory. * `using` argument to mail sending APIs. * `sent_using` attribute to mail.outbox messages in locmem backend. * MAILERS in startproject settings template, set to console backend. * AdminLogHandler.using argument. * BrokenLinkEmailsMiddleware.send_mail() method. Updated: * BaseEmailBackend to track the MAILERS alias used to construct it, and to report errors for unknown kwargs (OPTIONS). * EmailBackend implementations to initialize from kwargs (OPTIONS) only when MAILERS is being used. * smtp.EmailBackend to require `host` option and to default `port` option based on SSL/TLS options. * SimpleTestCase setup to substitute the locmem backend for all defined MAILERS configurations. * Django's tests that send mail to define MAILERS. Deprecated: * EMAIL_BACKEND and other backend-related EMAIL_* settings. * mail.get_connection(). * The `connection`, `fail_silently`, `auth_user`, and `auth_password` arguments to mail functions. * The EmailMessage.connection attribute. * BaseEmailBackend support for `fail_silently`. Backends that support fail_silently (SMTP, console, file) now implement it directly. * AdminEmailHandler.email_backend argument. Removed undocumented features without deprecation: * EmailMessage.get_connection() method. (send() now raises an error if a subclass has attempted to override it.) * EmailMessage.send() no longer sets self.connection to the connection used for sending. (It still _uses_ a pre-existing self.connection.) * AdminEmailHandler.connection() method. (Init now raises an error if a subclass has attempted to override it.) Thanks to Natalia Bidart for shepherding DEP 0018 and for extensive reviews and suggestions on the implementation. Thanks to Jacob Rief for the initial implementation and multiple iterations while refining the design. Co-authored-by: Jacob Rief <jacob.rief@gmail.com>
2026-03-13Fixed #36966 -- Fixed ValueError when `query_params` and `follow` are used ↵Marc Gibbons
on test client.
2026-02-26Fixed #22079 -- Added tests for stripping empty list values in RequestFactory.Anurag Verma
2026-02-21Fixed #36937 -- Added missing positive permission cases in test_client tests.Saish Mungase
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-01-03Fixed #35414 -- Used default headers in AsyncRequestFactory.YashRaj1506
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
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-04-12Refs #34482 -- Reverted "Fixed #32969 -- Fixed pickling HttpResponse and ↵Mariusz Felisiak
subclasses." This reverts commit d7f5bfd241666c0a76e90208da1e9ef81aec44db. Thanks Márton Salomváry for the report.
2023-01-04Refs #34074 -- Used headers argument for RequestFactory and Client in docs ↵David Wobrock
and tests.
2022-11-14Fixed #34074 -- Added headers argument to RequestFactory and Client classes.David Wobrock
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-20Fixed #32969 -- Fixed pickling HttpResponse and subclasses.Anv3sh
2022-05-02Removed 'tests' path prefix in a couple tests.Tim Graham
2022-04-06Fixed #33348 -- Changed ↵Baptiste Mispelon
SimpleTestCase.assertFormError()/assertFormsetErrors() to take form/formset. Instead of taking a response object and a context name for the form/formset, the two methods now take the object directly.
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-01-26Adjusted CBV resolver_match example in testing tools docs.Carlton Gibson
The view_class is available on the view callback, allowing that to be checked, rather than the __name__.
2021-10-20Refs #32956 -- Capitalized HTTP/HTTPS in comments, docs, and docstrings.David Smith
2021-09-24Fixed #33132 -- Fixed test client handling of querystring only redirects.Jaap Roes
Regression in 1e5aa8e1c79252cc810af21294a6e945d11d37b3.
2021-07-15Fixed #32929 -- Fixed handling query strings in AsyncRequestFactory.pochangl
2021-06-24Fixed ResourceWarning in ↵Mariusz Felisiak
test_client.tests.ClientTest.test_uploading_named_temp_file().
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-28Refs #25780 -- Removed redundant status code assertions from tests.Jon Dufresne
2020-09-14Fixed #31789 -- Added a new headers interface to HttpResponse.Tom Carrick
2020-05-27Fixed #31494 -- Preserved query strings when following HTTP 307/308 ↵Ahmad A. Hussein
redirects in test client.
2020-05-27Refs #31494 -- Added test for query strings for GET/HEAD requests when ↵Ahmad A. Hussein
following HTTP 307/308 redirects in test client.
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-08-11Fixed #30677 -- Improved error message for urlencode() and Client when None ↵swatantra
is passed as data.
2019-03-15Cleaned up exception message checking in some tests.Jon Dufresne
2019-02-20Fixed #18707 -- Added support for the test client to return 500 responses.Jon Dufresne
2018-12-27Fixed #30024 -- Made urlencode() and Client raise TypeError when None is ↵Jon Dufresne
passed as data.
2018-11-27Made reused RequestFactory instances class attributes.Simon Charette
2018-08-25Fixed #29687 -- Allowed the test client to serialize list/tuple as JSON.Dan Palmer
2018-07-09Fixed #29553 -- Made test client set Content-Length header to a string ↵Tim Graham
rather than integer.
2018-06-20Fixed #27398 -- Added an assertion to compare URLs, ignoring the order of ↵Jan Pieter Waagmeester
their query strings.
2018-03-16Fixed hanging indentation in various code.Mariusz Felisiak
2018-02-12Added a test for Client.generic() data coercion.Tim Graham
The smart_str() call (now force_bytes()) added in e73838b6ddcc7b37c03f9eee04fa6e6a283fedb3 is otherwise untested.
2018-02-12Refs #20530 -- Added a test for test client query string encoding.Tim Graham
7bb627936034c1b9500a8d250cce75b30f980b23 is only tested in django-contrib-comments.
2018-02-06Fixed #29082 -- Allowed the test client to encode JSON request data.Nick Sarbicki
2018-02-06Fixed #27999 -- Added test client support for HTTP 307 and 308 redirects.Tom
2017-11-28Fixed #28837 -- Fixed test client crash if an exception with more than one ↵Nicolas Delaby
arg is raised. Also removed usage of the problematic pattern elsewhere. Regression in 6e55e1d88a5c4453e25f0caf7ffb68973de5c0ba.
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2016-12-12Refs #27184 -- Fixed unclosed file ResourceWarning in test_client test.Jon Dufresne