Commit Graph

69 Commits

Author SHA1 Message Date
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
pscottdevos 7fa1dd8a80 Fixed #25163 -- Fixed exception handling in nested test client requests. 2015-08-11 10:01:24 -04:00
Jon Dufresne b44dee16e6 Fixed #20916 -- Added Client.force_login() to bypass authentication. 2015-07-01 13:01:08 -04:00
Simon Charette be67400b47 Refs #24652 -- Used SimpleTestCase where appropriate. 2015-05-20 13:46:13 -04:00
Claude Paroz a0c2eb46dd Fixed #23960 -- Removed http.fix_location_header
Thanks Carl Meyer for the report and Tim Graham for the review.
2015-03-18 18:22:50 +01:00
Josh Smeaton 39a7eed1bb Converted test fixtures to setUpTestData methods 2015-03-05 10:10:32 +11:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
darkryder 9ec8aa5e5d Fixed #24149 -- Normalized tuple settings to lists. 2015-02-03 14:59:45 -05:00
Berker Peksag 47789410db Corrected deprecation warnings for RedirectView; refs #21587. 2014-11-28 17:59:55 -05:00
Berker Peksag 9a30acad8a Fixed #21587 -- Added a warning for changing default of RedirectView.permanent. 2014-11-25 09:22:18 -05:00
Rigel Di Scala 28634394f5 Fixed #23606 -- Implemented Client and RequestFactory trace() methods.
Thanks KevinEtienne for the suggestion.
2014-10-28 10:11:12 -04:00
Loic Bistuer 2f3a4cd573 Removed numbering from the models.py header of some test packages.
This is a reliqua from the early days of the modeltests/regressiontests era.
2014-09-24 17:28:56 +07:00