Commit Graph

80 Commits

Author SHA1 Message Date
pochangl f6d3557aa1
Fixed #32929 -- Fixed handling query strings in AsyncRequestFactory. 2021-07-15 13:09:29 +02:00
Mariusz Felisiak 27e156fa31
Fixed ResourceWarning in test_client.tests.ClientTest.test_uploading_named_temp_file(). 2021-06-24 11:47:29 +02:00
tomhamiltonstubber 1e5aa8e1c7 Fixed #32790 -- Ensured test Client handles redirects to domain indexes without a specified trailing slash. 2021-06-23 12:32:29 +02:00
Marc Gibbons d6572ee4b0 Fixed #32470 -- Fixed ResolverMatch instance on test clients when request.urlconf is set. 2021-02-23 09:54:49 +01:00
Carlton Gibson ebb08d1942
Fixed #32159 -- Ensured AsyncRequestFactory correctly sets headers. 2020-11-04 11:07:15 +01:00
Patrick Arminio 542b4b3ab4 Fixed #32162 -- Fixed setting Content-Length header in AsyncRequestFactory. 2020-11-03 10:12:40 +01:00
Jon Dufresne cee93c6ba1 Refs #25780 -- Removed redundant status code assertions from tests. 2020-10-28 12:26:49 +01:00
Tom Carrick bcc2befd0e Fixed #31789 -- Added a new headers interface to HttpResponse. 2020-09-14 08:41:59 +02:00
Ahmad A. Hussein 7c947f0f5a Fixed #31494 -- Preserved query strings when following HTTP 307/308 redirects in test client. 2020-05-27 10:36:52 +02:00
Ahmad A. Hussein 6425fd3124 Refs #31494 -- Added test for query strings for GET/HEAD requests when following HTTP 307/308 redirects in test client. 2020-05-27 10:36:52 +02:00
Andrew Godwin fc0fa72ff4 Fixed #31224 -- Added support for asynchronous views and middleware.
This implements support for asynchronous views, asynchronous tests,
asynchronous middleware, and an asynchronous test client.
2020-03-18 19:59:12 +01:00
swatantra 73ac9e3f04 Fixed #30677 -- Improved error message for urlencode() and Client when None is passed as data. 2019-08-11 20:15:23 +02:00
Jon Dufresne 95b7699ffc Cleaned up exception message checking in some tests. 2019-03-15 19:27:57 -04:00
Jon Dufresne 7feddd878c Fixed #18707 -- Added support for the test client to return 500 responses. 2019-02-20 12:16:10 +01:00
Jon Dufresne 6fe9c45b72 Fixed #30024 -- Made urlencode() and Client raise TypeError when None is passed as data. 2018-12-27 11:19:55 -05:00
Simon Charette 0f212db29d Made reused RequestFactory instances class attributes. 2018-11-27 09:49:02 -05:00
Dan Palmer e181666973 Fixed #29687 -- Allowed the test client to serialize list/tuple as JSON. 2018-08-25 10:57:05 -04:00
Tim Graham 5bea8d256d
Fixed #29553 -- Made test client set Content-Length header to a string rather than integer. 2018-07-09 11:44:49 -04:00
Jan Pieter Waagmeester 24959e48d9 Fixed #27398 -- Added an assertion to compare URLs, ignoring the order of their query strings. 2018-06-20 13:26:12 -04:00
Mariusz Felisiak 362813d628
Fixed hanging indentation in various code. 2018-03-16 10:54:34 +01:00
Tim Graham a6fb81750a Added a test for Client.generic() data coercion.
The smart_str() call (now force_bytes()) added in
e73838b6dd is otherwise untested.
2018-02-12 12:53:02 -05:00
Tim Graham 4206765a5b Refs #20530 -- Added a test for test client query string encoding.
7bb6279360 is only tested in
django-contrib-comments.
2018-02-12 10:20:53 -05:00
Nick Sarbicki 47268242b0 Fixed #29082 -- Allowed the test client to encode JSON request data. 2018-02-06 18:29:04 -05:00
Tom 272f685794 Fixed #27999 -- Added test client support for HTTP 307 and 308 redirects. 2018-02-06 09:03:43 -05:00
Nicolas Delaby 746caf3ef8 Fixed #28837 -- Fixed test client crash if an exception with more than one arg is raised.
Also removed usage of the problematic pattern elsewhere.

Regression in 6e55e1d88a.
2017-11-28 18:55:23 -05:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Jon Dufresne 8db6a6c0a1 Refs #27184 -- Fixed unclosed file ResourceWarning in test_client test. 2016-12-12 12:41:38 -05:00
Anton Samarchyan 47744a0a4e Fixed #27542 -- Made Client.force_login() skip auth backends without get_user(). 2016-12-01 09:50:08 -05:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
Tom Scrace e7dfb60353 Tested the test client uploading of NamedTemporaryFile. 2016-11-09 05:40:08 -05:00
Tom Scrace 5549e89b84 Fixed #27184 -- Allowed uploading TemporaryFile with the test client.
Thanks Federico Capoano for finishing the patch.
2016-11-09 05:33:22 -05:00
Ben Demboski fc8f097117 Fixed #27027 -- Restored Client.force_login() defaulting to the first auth backend. 2016-08-06 08:41:41 -04:00
Tim Graham c9ae09addf Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions.
2016-06-28 11:21:26 -04:00
Tobias McNulty 17e661641d Refs #26666 -- Added ALLOWED_HOSTS validation when running tests.
Also used ALLOWED_HOSTS to check for external hosts in assertRedirects().
2016-06-20 11:07:46 -04:00
Jon Dufresne 4f336f6652 Fixed #26747 -- Used more specific assertions in the Django test suite. 2016-06-16 14:19:18 -04:00
Tobias McNulty c7b1b81352 Fixed #26666 -- Added more useful error message to assertRedirects 2016-06-02 14:43:31 -07:00
Florian Apolloner 9baf692a58 Fixed #26601 -- Improved middleware per DEP 0005.
Thanks Tim Graham for polishing the patch, updating the tests, and
writing documentation. Thanks Carl Meyer for shepherding the DEP.
2016-05-17 07:22:22 -04:00
Tim Graham 2f698cd991 Refs #26428 -- Added support for relative path redirects to the test client.
Thanks iktyrrell for the patch.
2016-04-29 09:15:28 -04:00
Sergey Kolosov 21dd98a386 Fixed #25699 -- Allowed using the test client if 'django.contrib.sessions' isn't in INSTALLED_APPS. 2016-04-04 07:48:48 -04:00
Tim Graham d2569f89f2 Fixed #26428 -- Added support for relative path redirects in assertRedirects().
Thanks Trac alias master for the report and review.
2016-04-02 10:35:33 -04:00
Alexander Gaevsky 107165c4b0 Fixed #24987 -- Allowed inactive users to login with the test client. 2016-03-23 09:01:52 -04:00
Alexander Gaevsky e0a3d93730 Fixed #25232 -- Made ModelBackend/RemoteUserBackend reject inactive users. 2016-03-23 09:01:48 -04:00
Tim Graham 015fad9060 Fixed #26175 -- Removed SHA1 password hashes in tests. 2016-02-06 08:47:21 -05:00
Hasan 3d0dcd7f5a Refs #26022 -- Used context manager version of assertRaises in tests. 2016-01-29 12:32:18 -05:00
userimack 60586dd737 Fixed #26125 -- Fixed E731 flake warnings. 2016-01-25 14:23:43 -05:00
Paulo Poiati b643386668 Fixed #24855 -- Allowed using contrib.auth.login() without credentials.
Added an optional `backend` argument to login().
2016-01-07 08:56:07 -05:00
Marten Kenbeek 16411b8400 Fixed #26013 -- Moved django.core.urlresolvers to django.urls.
Thanks to Tim Graham for the review.
2015-12-31 14:21:29 -05:00
Alex Morozov 13dba4dba3 Fixed #25780 -- Removed redundant status code assertions from tests 2015-11-21 18:12:33 +01:00
Travis Jensen 1a09b3c398 Fixed #25424 -- Use force_str for test client URLs.
urlparse() fails with an AttributeError ("'__proxy__' object has no
attribute 'decode'") if reverse_lazy is used to look up the URL
(this is exactly the same problem that caused ticket #18776). The
solution is to use force_str() on the path before handing it to
urlparse().
2015-09-19 15:05:54 +02:00
Dražen Odobašić b1e33ceced Fixed #23395 -- Limited line lengths to 119 characters. 2015-09-12 11:40:50 -04:00