Commit Graph

11959 Commits

Author SHA1 Message Date
Mateo Radman 61c5eae516 Refs #32900 -- Added makemigrations tests for messages in interactive mode. 2021-08-27 13:27:41 +02:00
Mateo Radman d00fb4d2d6 Refs #32900 -- Added test for ignoring the default value in InteractiveMigrationQuestioner.ask_not_null_alteration(). 2021-08-27 13:27:37 +02:00
Hasan Ramezani d1216e126f Fixed #33051 -- Fixed highlighting the current model in admin's sidebar with non-ASCII model names. 2021-08-27 07:31:05 +02:00
David Smith 5942ab5eb1 Refs #32338 -- Made RadioSelect/CheckboxSelectMultiple render in <div> tags.
This improves accessibility for screen reader users.
2021-08-27 06:14:01 +02:00
Mariusz Felisiak fa1d7ba5b9
Refs #29898 -- Changed fields in ProjectState's relation registry to dict. 2021-08-26 07:49:37 +02:00
Manav Agarwal 196a99da5d Refs #29898 -- Made ProjectState encapsulate alterations in relations registry.
Thanks Simon Charette and Chris Jerdonek for reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-08-25 09:12:01 +02:00
Chris Jerdonek b263f4b69d Fixed #32552 -- Added logger argument to DiscoverRunner. 2021-08-24 09:23:01 +02:00
Tim Graham 022d29c934
Refs #10929 -- Allowed NowUTC SQL customization for third-party backends. 2021-08-24 08:28:03 +02:00
Märt Häkkinen ed317e79e3 Fixed #33030 -- Fixed broken links to GDAL docs. 2021-08-23 06:22:07 +02:00
Matjaz Gregoric 518ce7a51f Fixed #33017 -- Fixed storage engine introspection on MySQL.
This also improves performance on MySQL instances with a large number
of databases, since querying the information_schema table can be very
slow
2021-08-20 11:05:21 +02:00
Chris Jerdonek faf6d48590 Removed reference to nonexistent collectstatic --exclude-dirs option. 2021-08-19 12:49:46 +02:00
Chris Jerdonek 7800596924 Fixed #33014 -- Made ProjectState raise exception when real_apps argument is not a set. 2021-08-19 10:18:51 +02:00
Jonny Park 4e8121e8e4 Fixed #32994 -- Fixed autoreloader tests when using 'python -m'. 2021-08-19 09:20:31 +02:00
Mariusz Felisiak 36714be874 Refs #31621 -- Fixed handling --parallel option in test management command and runtests.py.
Regression in ae89daf46f.
Thanks Tim Graham for the report.
2021-08-19 09:18:32 +02:00
Mariusz Felisiak c2a5735d86 Refs #31621 -- Added more tests for test --parallel option. 2021-08-19 09:18:32 +02:00
Matt Westcott 5092f7247d Fixed #33036 -- Made simple_tag()/inclusion_tag() with takes_context raise TemplateSyntaxError when function has no parameters. 2021-08-19 07:39:55 +02:00
Chris Jerdonek be1fd6645d Refs #32800 -- Added test_masked_secret_accepted_and_not_replaced().
This improves test_bare_secret_accepted_and_replaced() by adding a stronger
assertion. It also adds a parallel test for the non-bare (masked) case.
2021-08-17 12:23:54 +02:00
Chris Jerdonek 7aba820aca Refs #32800 -- Improved CsrfViewMiddlewareTestMixin._check_token_present().
This changes CsrfViewMiddlewareTestMixin._check_token_present() to give more
detailed information if the check fails, and in particular why it failed. It
also moves CsrfFunctionTests.assertMaskedSecretCorrect() to a separate
CsrfFunctionTestMixin so the helper can be used in CsrfViewMiddlewareTestMixin.
2021-08-17 12:23:54 +02:00
Chris Jerdonek 26d8e3f302 Refs #32800 -- Used the cookie argument to CsrfViewMiddlewareTestMixin._get_request() in more tests. 2021-08-17 12:23:54 +02:00
Mariusz Felisiak 54a30a7a00 Refs #29898 -- Changed ProjectState.real_apps to set. 2021-08-11 09:01:14 +02:00
David Smith 3a6431db54 Refs #29205 -- Added MultiValueField test for rendering of optional subfields. 2021-08-10 12:49:06 +02:00
Mart Sõmermaa 9b1158a7e0 Fixed #32993 -- Added AutocompleteJsonView.serialize_result() to allow customization. 2021-08-10 07:44:37 +02:00
Mariusz Felisiak 65ed96fa39 Refs #33002 -- Added DebugLexer/Lexer.tokenize() test for trailing text token. 2021-08-09 13:42:26 +02:00
Chris Jerdonek b2be7e12cc Refs #33002 -- Made template_tests.tests.py's tests test both Lexer and DebugLexer. 2021-08-09 13:37:02 +02:00
Greg Twohig c99aaf14ee Refs #32990 -- Added tests for DebugLexer/Lexer.tokenize(). 2021-08-09 08:21:37 +02:00
David Smith 8208381ba6 Refs #32956 -- Corrected spelling of daylight saving time.
AP Stylebook: Saving not savings, no hyphen, and lowercase.
2021-08-06 13:00:24 +02:00
Mariusz Felisiak 61d92c650f Refs #22123 -- Added more URLValidator test for invalid IPv6 literals. 2021-08-06 12:58:55 +02:00
Nick Touran 5d4f21b16f Fixed #32983 -- Added system check for redundant related_name on symmetrical M2M fields.
Since ManyToManyFields defined with `symmetrical=True` do not add a
related field to the target model, including a `related_name` argument
will never do what the coder likely expects. This makes including
a related_name with a symmetrical model raise a system check warning.

ticket-32983
2021-08-06 11:57:02 +02:00
Nick Touran 1fb21ab377 Refs #32983 -- Removed unneeded related_name from test model definitions. 2021-08-06 11:57:02 +02:00
Jarosław Wygoda d3c4696596 Fixed #27590 -- Allowed customizing a manifest file storage in ManifestFilesMixin. 2021-08-05 12:40:34 +02:00
Mariusz Felisiak ab16507f19
Fixed #32988 -- Prevented creation of more test databases than TestCases.
DiscoverRunner.parallel is used in setup_databases() and
teardown_databases() to control the number of test databases.

Regression in cb6c19749d.
2021-08-05 05:55:35 +02:00
Jacob Walls 2d0ae8da80 Fixed #29205 -- Corrected rendering of required attributes for MultiValueField subfields. 2021-08-04 17:37:04 +02:00
Jacob Rief db1fc5cd3c Fixed #32855 -- Corrected BoundWidget.id_for_label() with custom auto_id. 2021-08-04 15:18:00 +02:00
Jacob Walls 910ecd1b8d Fixed #29063 -- Fixed migrate crash when specifying a name of partially applied squashed migrations. 2021-08-04 09:57:32 +02:00
Jacob Walls 202d3e193a Fixed typos in migrations tests, comments, and error message. 2021-08-04 09:28:23 +02:00
Mariusz Felisiak 52f9cfee9f Used assertRaisesMessage() to test MigrationLoader.get_migration_by_prefix()'s error messages. 2021-08-04 09:20:26 +02:00
Michał Górny 7afca03c40 Refs #32074 -- Fixed CommandTests.test_subparser_invalid_option on Python 3.10+.
Python 3.10.0rc1 changed the error messages issued by argparse on
invalid choice to include the argument name. Update the expected test
output to account for that.
2021-08-04 07:59:08 +02:00
Ties Jan Hefting 4f3acf9579 Fixed #32984 -- Allowed customizing a deletion field widget in formsets. 2021-08-03 13:12:50 +02:00
Ties Jan Hefting 47cb85b542 Fixed typos in tests/forms_tests/tests/test_formsets.py. 2021-08-03 12:53:45 +02:00
Adam Johnson ae89daf46f Fixed #31621 -- Added support for '--parallel auto' to test management command. 2021-08-03 09:57:04 +02:00
Adam Johnson 7e38a8d66f Refs #31621 -- Added more tests for test --parallel option. 2021-08-03 09:57:04 +02:00
Chris Jerdonek 795051b2b0 Refs #32800 -- Added tests of more CSRF functions. 2021-08-03 07:16:31 +02:00
Chris Jerdonek 7132341255 Refs #32800 -- Renamed _compare_masked_tokens() to _does_token_match(). 2021-08-03 07:10:31 +02:00
Mariusz Felisiak 34d5336b9d Added test for TemplateSyntaxError when variables begin with underscores. 2021-08-02 11:37:39 +02:00
David Smith f9b7704ab3
Refs #32956 -- Corrected spelling of "gray". 2021-08-02 07:51:24 +02:00
David Smith 6802ac4415
Refs #32956 -- Corrected usage of "insure" and "assure". 2021-08-02 07:45:26 +02:00
David Smith fbb1984046
Refs #32956 -- Updated words ending in -wards.
AP styleguide: Virtually none of the words ending with -wards end with
an s.
2021-07-30 20:34:50 +02:00
Chris Jerdonek 542e749475 Fixed #32966 -- Fixed TimeField.check() crash for timezone-aware times in default when USE_TZ = True. 2021-07-30 09:15:39 +02:00
Jonathan Davis 4c6a6d5ac7
Fixed #23895 -- Prevented pickling of ResolverMatch.
Pickling a ResolverMatch did not work correctly in many cases,
especially with CBVs and URLResolvers in the list of tried URL paths.
2021-07-29 07:04:56 +02:00
David Smith 1024b5e74a Fixed 32956 -- Lowercased spelling of "web" and "web framework" where appropriate. 2021-07-29 06:24:12 +02:00
chrishna1 033636286a Fixed #32959 -- Moved tests URLs to validators.tests. 2021-07-28 11:39:36 +02:00
David Smith 1cba320786
Refs #32956 -- Changed "afterwards" to "afterward" in docs and comments.
This also removes unnecessary comments with the previous spelling.

AP Stylebook has a short entry to advise the preferred spelling for
"en-us". "Afterwards" is preferred in British English.
2021-07-27 10:41:51 +02:00
Jordan Bae 3d9040a50b Refs #32743 -- Fixed recreation of foreign key constraints when altering type of referenced primary key with MTI.
Follow up to 325d7710ce.
2021-07-27 07:30:33 +02:00
abhiabhi94 5a634a7b6f Fixed #32906 -- Added docs and tests for using key and index lookups on JSONBAgg results.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-26 11:23:51 +02:00
David Wobrock 325d7710ce Fixed #32743 -- Added foreign key altering when altering type of referenced primary key with MTI. 2021-07-26 08:51:56 +02:00
Tom Wojcik 20226fcd46 Fixed #32947 -- Fixed hash() crash on reverse M2M relation when through_fields is a list.
Regression in c32d8f33d8.
2021-07-26 06:09:29 +02:00
Virtosu Bogdan 00ea883ef5 Fixed #32329 -- Made CsrfViewMiddleware catch more specific UnreadablePostError.
Thanks Chris Jerdonek for the review.
2021-07-23 13:10:41 +02:00
Virtosu Bogdan 852fa7617e Refs #32329 -- Allowed specifying request class in csrf_tests test hooks. 2021-07-23 12:13:31 +02:00
Nick Pope 6b513f0137
Fixed #32913 -- Made watchman reloader tests less flaky. 2021-07-23 11:40:57 +02:00
Chris Jerdonek 3cfcb8cbc8 Refs #32902 -- Moved ensure_csrf_cookie_view after protected_view. 2021-07-23 07:09:36 +02:00
Chris Jerdonek a2e1f1e295 Fixed #32902 -- Fixed CsrfViewMiddleware.process_response()'s cookie reset logic.
Thanks Florian Apolloner and Shai Berger for reviews.
2021-07-23 07:08:45 +02:00
Chris Jerdonek 311401d9a2 Refs #32902 -- Added CSRF test when rotate_token() is called between resetting the token and processing response. 2021-07-23 06:56:53 +02:00
ryowright 1783b3cb24 Fixed #32275 -- Added scrypt password hasher.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-22 12:40:33 +02:00
Wu Haotian 65b880b726 Fixed #32930 -- Fixed URLValidator when port numbers < 10. 2021-07-22 11:58:28 +02:00
Wu Haotian b96cc7f85e Added more test cases with port numbers for URLValidator. 2021-07-22 11:58:28 +02:00
Mariusz Felisiak 83022d279c
Refs #32508 -- Raised TypeError/ValueError instead of using "assert" in encode() methods of some password hashers. 2021-07-22 09:42:07 +02:00
Nick Pope c35b81b864 Fixed #32951 -- Removed Query.where_class & co.
Unused since 3caf957ed5.
2021-07-22 08:49:20 +02:00
yakimka c542d0a072 Fixed #32949 -- Restored invalid number handling in DecimalField.validate().
DecimalField must itself validate() values, such as NaN, which cannot be
passed to validators, such as MaxValueValidator, during the
run_validators() phase.

Regression in cc3d24d7d5.
2021-07-21 10:20:24 +02:00
David Wobrock fd999318ad Fixed #32704 -- Fixed list of deferred fields when chaining QuerySet.defer() after only(). 2021-07-20 12:15:29 +02:00
David Wobrock 96706d76cd Added more tests for chaining QuerySet.defer() after only(). 2021-07-20 12:14:28 +02:00
Nick Pope fee8734596 Refs #10929 -- Deprecated forced empty result value for PostgreSQL aggregates.
This deprecates forcing a return value for ArrayAgg, JSONBAgg, and
StringAgg when there are no rows in the query. Now that we have a
``default`` argument for aggregates, we want to revert to returning the
default of ``None`` which most aggregate functions return and leave it
up to the user to decide what they want to be returned by default.
2021-07-19 13:41:16 +02:00
Nick Pope 501a8db465 Fixed #10929 -- Added default argument to aggregates.
Thanks to Simon Charette and Adam Johnson for the reviews.
2021-07-19 13:04:27 +02:00
Keryn Knight 59942a66ce Fixed #32941 -- Removed get_format_modules()'s unused reverse argument.
Unused since 0d8b523422.
2021-07-19 11:42:20 +02:00
Chris Jerdonek f3825ee050
Fixed wording of AuthViewsTestCase's docstring. 2021-07-19 06:36:20 +02:00
Jacob Walls 56f9579105 Fixed #32655 -- Deprecated extra_tests argument for DiscoverRunner.build_suite()/run_tests(). 2021-07-16 20:46:41 +02:00
Chris Jerdonek 0dc25526d8 Fixed #32924 -- Changed BaseForm.get_initial_for_field() to remove microseconds when needed. 2021-07-16 15:51:20 +02:00
Chris Jerdonek 788441c6ab Refs #32924 -- Changed test_initial_datetime_values() to use subTests. 2021-07-16 15:51:20 +02:00
Chris Jerdonek 469e769299 Refs #32924 -- Changed test_get_initial_for_field() to use subTests. 2021-07-16 15:51:20 +02:00
pochangl f6d3557aa1
Fixed #32929 -- Fixed handling query strings in AsyncRequestFactory. 2021-07-15 13:09:29 +02:00
Daniyal f479df7f8d Refs #32508 -- Raised Type/ValueError instead of using "assert" in django.db.models.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-15 11:43:33 +02:00
Chris Jerdonek 90a33ab2ce Fixed #32920 -- Changed BaseForm to access its values through bound fields. 2021-07-15 10:47:02 +02:00
Ties Jan Hefting 84400d2e9d Fixed #32905 -- Added CSS class for non-form errors of formsets. 2021-07-15 07:00:39 +02:00
Carlton Gibson 3a45fea083 Fixed #21936 -- Allowed DeleteView to work with custom Forms and SuccessMessageMixin.
Thanks to Mariusz Felisiak for review.

Co-authored-by: Demetris Stavrou <demestav@gmail.com>
Co-authored-by: Caroline Simpson <github@hoojiboo.com>
2021-07-14 09:47:03 +02:00
Nick Pope 6afc2a944c Completed test coverage for django.utils.dateformat. 2021-07-13 13:21:10 +02:00
Nick Pope ab0d751ddf Used subTest() in utils_tests.test_dateformat. 2021-07-13 13:06:48 +02:00
Chris Jerdonek 5848b3a1d7 Fixed #32914 -- Prevented test --shuffle from skipping test methods.
"test --shuffle" skipped test methods when test classes were mixed.
This changes runner.py's reorder_tests() to group by TestCase class.

Regression in 90ba716bf0.
2021-07-12 06:36:12 +02:00
Ian Foote f42ccdd835 Fixed #27021 -- Allowed lookup expressions in annotations, aggregations, and QuerySet.filter().
Thanks Hannes Ljungberg and Simon Charette for reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-09 11:43:06 +02:00
Mariusz Felisiak ae32e337e0
Fixed isolation of NonAutocommitTests.test_orm_query_after_error_and_rollback(). 2021-07-09 07:38:31 +02:00
Mariusz Felisiak 7bb0605a8c
Fixed isolation of GenericRelationTests.test_filter_targets_related_pk(). 2021-07-08 13:13:40 +02:00
Chris Jerdonek 90ba716bf0 Fixed #24522 -- Added a --shuffle option to DiscoverRunner. 2021-07-08 07:29:04 +02:00
abhiabhi94 cf6774a53b Fixed #32904 -- Made parse_time() more strict.
Thanks Keryn Knight for the report.
2021-07-07 12:08:43 +02:00
Shipeng Feng 68cc04887b
Fixed #32866 -- Fixed trimming trailing punctuation from escaped string in urlize(). 2021-07-07 11:19:33 +02:00
Mads Jensen c51bf80d56 Used more specific unittest assertions in tests. 2021-07-07 10:51:38 +02:00
abhiabhi94 6a5ef557f8 Added test for errors when saving timezone-aware times if not supported. 2021-07-06 10:44:06 +02:00
Keryn Knight 857320e9e0 Added more tests for parse_time(). 2021-07-06 08:45:23 +02:00
Hannes Ljungberg a06b977a91 Fixed #32776 -- Added support for Array subqueries on PostgreSQL. 2021-07-06 07:36:52 +02:00
Mariusz Felisiak 49ca6bbc44
Fixed isolation of RouterTestCase.test_m2m_cross_database_protection().
Hardcoded pks are necessary for this test case, however we need to set
them for all new rows because the sequence will not increment
automatically. It works when the sequence is incremented by other
test cases.
2021-07-05 15:22:08 +02:00
Mateo Radman 2231429991 Refs #32508 -- Raised ImproperlyConfigured/TypeError instead of using "assert". 2021-07-05 13:31:03 +02:00
Mariusz Felisiak 1ff0ea6e9b
Fixed isolation of test_filename_traversal_upload().
shutil.rmtree(MEDIA_ROOT) is already called as a class cleanup.
2021-07-05 12:05:13 +02:00
Wu Haotian aba9c2de66 Fixed #32226 -- Fixed JSON format of QuerySet.explain() on PostgreSQL. 2021-07-05 09:08:39 +02:00