Commit Graph

107 Commits

Author SHA1 Message Date
Mariusz Felisiak 305757aec1
Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
2024-01-26 12:45:07 +01:00
Tom Carrick a03593967f Fixed #14611 -- Added query_params argument to RequestFactory and Client classes. 2023-11-23 10:39:29 +01:00
Chinmoy Chakraborty 1dae65dc63 Fixed #34657 -- Made assert(Not)Contains/assertInHTML display haystacks in error messages. 2023-10-03 10:44:36 +02:00
Mariusz Felisiak c2118d72d6
Fixed #34240 -- Preserved headers of requests made with django.test.Client in assertRedirects().
Bug in 67da22f08e.
2023-01-13 11:30:27 +01:00
David Wobrock 99bd5fb4c2 Refs #34074 -- Used headers argument for RequestFactory and Client in docs and tests. 2023-01-04 09:11:36 +01:00
Mariusz Felisiak 1a7d75cf77
Moved remaining SimpleTestCase.assertFormError()/assertFormsetErrors() tests to test_utils.
This also removes redundant tests in test_client_regress.

Follow up to 68144f4049.
2022-04-05 08:37:28 +02:00
Baptiste Mispelon d84cd91e90 Refs #33348 -- Improved messages raised by SimpleTestCase.assertFormError()/assertFormsetErrors().
This makes messages use BaseFormSet/BaseForm.__repr__() instead of
context, and adds the _assert_form_error() helper.
2022-02-15 07:15:44 +01:00
Mariusz Felisiak 7119f40c98 Refs #33476 -- Refactored code to strictly match 88 characters line length. 2022-02-07 20:37:05 +01:00
django-bot 9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Baptiste Mispelon 61b332499d Used assertRaisesMessage() in test_client_regress.AssertFormErrorTests. 2021-12-21 11:09:45 +01:00
Tom Carrick bcc2befd0e Fixed #31789 -- Added a new headers interface to HttpResponse. 2020-09-14 08:41:59 +02:00
Jon Dufresne d6aff369ad Refs #30116 -- Simplified regex match group access with Match.__getitem__().
The method has been available since Python 3.6. The shorter syntax is
also marginally faster.
2020-05-11 12:01:28 +02:00
Hasan Ramezani fc4f45ebdc Used assertRaisesMessage() in various tests. 2020-02-07 12:46:23 +01:00
Patrick Jenkins 46e74a5256 Fixed #28337 -- Preserved extra headers of requests made with django.test.Client in assertRedirects().
Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
2019-10-18 08:42:51 +02:00
Jon Dufresne d6ea4898c4 Fixed #30550 -- Fixed decoding of non-UTF-8 bytes objects in response.json(). 2019-06-07 06:40:15 +02:00
Jon Dufresne 8b3f1c35dd Removed unnecessary assignments in various code. 2019-04-24 13:09:29 +02:00
Jon Dufresne c492fdfd24 Removed default empty content argument from HttpResponse calls. 2019-02-09 16:27:32 -05:00
Tim Graham 043bd70942 Updated test URL patterns to use path() and re_path(). 2018-12-31 10:47:32 -05:00
Marnanel Thurman 7cc52250f0 Fixed #29662 -- Allowed test client to accept structured suffix JSON content types. 2018-08-15 10:27:45 -04:00
Thng Kai Yuan 71a739f3d7 Fixed #29576 -- Corrected the test client's HTTP_COOKIE header. 2018-07-21 18:14:39 -04:00
Tim Graham 9294110a57 Fixed #29520 -- Fixed test client crash when posting bytes.
Regression in b8a41a2872.
2018-06-27 14:50:03 -04:00
Chris Lamb 84ad721bd9 Fixed #29275 -- Made assertFormError() output "(actual errors: none)" instead of "(actual errors: )". 2018-03-31 18:35:45 -04:00
Claude Paroz 29592eef19 Decoupled test client encoding tests from JSON handling
Using JSON as non-UTF-8 content is controversial, and the RFC 7159
discourages it.
Thanks Tim Graham for the review.
2017-03-09 22:15:10 +01:00
Claude Paroz 145f6c3ed6 Refs #27622 -- Fixed a regression in JSON content-type detection
A JSON Content-Type can contain further content, like charset for example.
2017-03-07 16:44:15 +01:00
Claude Paroz 324c4b6371 Renamed a test variable to prevent possible conflict with imports 2017-03-07 16:31:00 +01:00
Tim Graham 500532c95d Refs #23919 -- Removed default 'utf-8' argument for str.encode()/decode(). 2017-02-09 09:03:47 -05:00
Claude Paroz c651331b34 Converted usage of ugettext* functions to their gettext* aliases
Thanks Tim Graham for the review.
2017-02-07 09:04:04 +01:00
Tim Graham 29f607927f Fixed spelling of "nonexistent". 2017-02-03 08:01:45 -05:00
Vytis Banaitis d1bab24e01 Refs #23919, #27778 -- Removed obsolete mentions of unicode. 2017-01-26 08:19:27 -05:00
chillaranand d6eaf7c018 Refs #23919 -- Replaced super(ClassName, self) with super(). 2017-01-25 12:23:46 -05:00
Claude Paroz 289fc1bfa5 Refs #23919 -- Removed str_prefix usage 2017-01-20 15:43:28 +01:00
Tim Graham 4e729feaa6 Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
These functions do nothing on Python 3.
2017-01-20 08:01:02 -05:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Claude Paroz 2b281cc35e Refs #23919 -- Removed most of remaining six usage
Thanks Tim Graham for the review.
2017-01-18 21:33:28 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Tim Graham 0f454f5d4d Refs #23960 -- Removed the host parameter for SimpleTestCase.assertRedirects().
Per deprecation timeline.
2017-01-17 14:09:28 -05:00
Tim Graham 8516f7c49b Fixed #27698 -- Added django.test.utils.ContextList.get() 2017-01-06 19:23:42 -05:00
Anton Samarchyan 0b5d4c49d6 Fixed #27622 -- Allowed test client to accept vendor tree JSON content types. 2016-12-29 08:32:15 -05:00
Adam Chainz 19e2114634 Fixed #27516 -- Made test client's response.json() cache the parsed JSON. 2016-11-21 08:14:03 -05:00
Ramin Farajpour Cami 0a63ef3f61 Fixed #27463 -- Fixed E741 flake8 warnings. 2016-11-14 17:40:28 -05:00
Tim Graham 6072de727f Decorated a few functions. 2016-11-14 12:20:44 -05:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
Aleksej Manaev 4b9330ccc0 Fixed #25187 -- Made request available in authentication backends. 2016-09-12 20:11:53 -04:00
Chris Jerdonek 7bc5274f6f Fixed #27012 -- Removed unnecessary setup_test_environment() in a test. 2016-08-04 09:35:44 -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
Tim Graham 92053acbb9 Fixed E128 flake8 warnings in tests/. 2016-04-08 10:12:33 -04:00
Tim Graham 015fad9060 Fixed #26175 -- Removed SHA1 password hashes in tests. 2016-02-06 08:47:21 -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