summaryrefslogtreecommitdiff
path: root/tests/test_utils
AgeCommit message (Collapse)Author
2022-02-22Removed redundant QuerySet.all() calls in docs and tests.Nick Pope
Most QuerySet methods are mapped onto the Manager and, in general, it isn't necessary to call .all() on the manager.
2022-02-15Refs #33348 -- Made SimpleTestCase.assertFormError() raise ValueError when ↵Baptiste Mispelon
"field" is passed without "form_index".
2022-02-15Refs #33348 -- Fixed SimpleTestCase.assertFormError() error message raised ↵Mariusz Felisiak
for unbound forms.
2022-02-15Refs #33348 -- Improved messages raised by ↵Baptiste Mispelon
SimpleTestCase.assertFormError()/assertFormsetErrors(). This makes messages use BaseFormSet/BaseForm.__repr__() instead of context, and adds the _assert_form_error() helper.
2022-02-14Refs #33348 -- Made SimpleTestCase.assertFormsetErrors() raise an error when ↵Baptiste Mispelon
form_index is too big.
2022-02-14Refs #33348 -- Made SimpleTestCase.assertFormError()/assertFormsetErrors() ↵Baptiste Mispelon
raise an error for unbound forms/formsets.
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-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-06Refs #33348 -- Deprecated passing errors=None to ↵Baptiste Mispelon
SimpleTestCase.assertFormError()/assertFormsetErrors().
2022-01-06Fixed #33410 -- Fixed recursive capturing of callbacks by ↵Petter Friberg
TestCase.captureOnCommitCallbacks(). Regression in d89f976bddb49fb168334960acc8979c3de991fa.
2022-01-05Fixed #33400 -- Added support for msg_prefix and count arguments to ↵Ad Timmering
assertTemplateUsed()/assertTemplateNotUsed() used as context managers.
2021-12-08Fixed #33346 -- Fixed SimpleTestCase.assertFormsetError() crash on a formset ↵Baptiste Mispelon
named "form". Thanks OutOfFocus4 for the report. Regression in 456466d932830b096d39806e291fe23ec5ed38d5.
2021-12-03Fixed #33333 -- Fixed setUpTestData() crash with models.BinaryField on ↵Mariusz Felisiak
PostgreSQL. This makes models.BinaryField pickleable on PostgreSQL. Regression in 3cf80d3fcf7446afdde16a2be515c423f720e54d. Thanks Adam Zimmerman for the report.
2021-11-26Refs #33301 -- Made SimpleTestCase.assertFormError()/assertFormsetErrors() ↵Baptiste Mispelon
raise ValueError for non test client responses.
2021-11-26Added tests for SimpleTestCase.assertFormError()/assertFormsetErrors().Baptiste Mispelon
2021-11-15Fixed #33278 -- Improved error for connection/query attempts against ↵SwastikTripathi
disallowed databases in tests.
2021-10-29Fixed #33236 -- Fixed assertHTMLEqual() error messages for escaped HTML.Pratyush Mittal
2021-09-20Refs #31235 -- Made assertQuerysetEqual() not call repr() on a queryset when ↵Mariusz Felisiak
compared to string values. Per deprecation timeline.
2021-09-20Refs #31395 -- Removed support for assigning objects which don't support ↵Mariusz Felisiak
deepcopy() in setUpTestData(). Per deprecation timeline.
2021-08-30Fixed #33054 -- Made TestCase.captureOnCommitCallbacks() capture callbacks ↵Eugene Morozov
recursively.
2021-07-05Refs #32508 -- Raised ImproperlyConfigured/TypeError instead of using "assert".Mateo Radman
2021-06-04Made SerializeMixin check lockfile attr at import time.Adam Johnson
2021-03-19Fixed #32556 -- Fixed handling empty string as non-boolean attributes value ↵Baptiste Mispelon
by assertHTMLEqual().
2021-03-18Fixed #32556 -- Fixed assertHTMLEqual() to handle empty string as boolean ↵Hasan Ramezani
attributes value.
2021-03-02Refs #21429 -- Added SimpleTestCase.assertNoLogs() on Python < 3.10.François Freitag
2021-02-26Fixed typo in assertQuerysetEqual() exception message.Jacob Walls
2021-02-22Fixed #32469 -- Made assertQuerysetEqual() respect maxDiff when ordered=False.Nick Pope
2020-11-06Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly.Hasan Ramezani
This also replaces assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() where appropriate. Co-authored-by: Peter Inglesby <peter.inglesby@gmail.com> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-09-24Fixed #27906 -- Fixed test tools counting of HTML matches for subsets of ↵Jacob Walls
elements. Previously examples such as '<a/><b/>' would not match in '<a/><b/><c/>'.
2020-09-07Fixed #31944 -- Used addCleanup() to register TestContextDecorator cleanups.François Freitag
Cleanups from addCleanup() are scheduled to happen in reverse order to the order they are added (LIFO). Ensures each cleanup is executed from the innermost to the outermost.
2020-07-13Fixed #30457 -- Added TestCase.captureOnCommitCallbacks().Adam Johnson
2020-05-15Fixed #31395 -- Made setUpTestData enforce in-memory data isolation.Simon Charette
Since it's introduction in Django 1.8 setUpTestData has been suffering from a documented but confusing caveat due to its sharing of attributes assigned during its execution with all test instances. By keeping track of class attributes assigned during the setUpTestData phase its possible to ensure only deep copies are provided to test instances on attribute retreival and prevent manual setUp gymnastic to work around the previous lack of in-memory data isolation. Thanks Adam Johnson for the extensive review.
2020-04-20Capitalized Unicode in docs, strings, and comments.Jon Dufresne
2020-04-15Removed unused __str__() methods in tests models.Author: Mads Jensen
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
2020-02-14Removed unused and incorrect PossessedCar.__str__() method in test_utils.Mariusz Felisiak
PossessedCar doesn't have a color.
2020-02-13Fixed #31250 -- Ignored processing instructions in ↵yura
assertXMLEqual()/assertXMLNotEqual().
2020-02-07Used assertRaisesMessage() in various tests.Hasan Ramezani
2020-02-06Fixed #31233 -- Closed database connections and cursors after use.Jon Dufresne
2020-01-20Refs #31117 -- Made various tests properly handle unexpected databases aliases.Matthijs Kooijman
- Used selected "databases" instead of django.db.connections. - Made routers in tests.migrations skip migrations on unexpected databases. - Added DiscoverRunnerGetDatabasesTests.assertSkippedDatabases() hook which properly asserts messages about skipped databases.
2019-10-18Fixed #27391 -- Implemented SimpleTestCase.debug().Pavel Savchenko
debug() should bubbled up exceptions if occurring in test, but behave the same as run() when no exceptions occurred.
2019-10-18Refs #27391 -- Added more tests for SimpleTestCase.Pavel Savchenko
2019-09-10Refs #28478 -- Removed support for TestCase's allow_database_queries and ↵Mariusz Felisiak
multi_db per deprecation timeline.
2019-05-24Fixed #30497 -- Ignored document type in assertXMLEqual()/assertXMLNotEqual().Caio Ariede
2019-05-10Fixed #30470 -- Added assertHTMLEqual() support for all self closing tags.Jon Dufresne
Support for the following tags was added: area, embed, param, track, and wbr. The full list of self closing tags is documented at: https://html.spec.whatwg.org/#void-elements
2019-05-09Fixed #30468 -- Fixed assertHTMLEqual() to handle all ASCII whitespace in a ↵Jon Dufresne
class attribute.
2019-05-09Refs #27804 -- Used subTest() in HTMLEqualTests.test_self_closing_tags. Jon Dufresne
2019-05-09Refs #30399 -- Made assertHTMLEqual normalize character and entity references.Jon Dufresne
2019-04-29Refs #26022 -- Used context manager version of assertRaisesMessage in tests.Jon Dufresne
Follow up to 253adc2b8a52982139d40c4f55b3fd446e1cb8f3.
2019-02-09Removed default empty content argument from HttpResponse calls.Jon Dufresne