diff options
author | Anton Samarchyan <anton.samarchyan@savoirfairelinux.com> | 2017-06-02 18:44:34 -0400 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-06-02 18:47:07 -0400 |
commit | 2b53c8377dcb7270d95db0b3ea8b2cb28550c5a8 (patch) | |
tree | 548b035895c3796bdca4c077bfe9d99330af34c7 /tests/modeladmin | |
parent | 7c9a83330169df1118f6bd690aed131e7c59638d (diff) | |
download | django-2b53c8377dcb7270d95db0b3ea8b2cb28550c5a8.tar.gz |
Improved test coverage of contrib/admin/checks.py.
Diffstat (limited to 'tests/modeladmin')
-rw-r--r-- | tests/modeladmin/test_checks.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/modeladmin/test_checks.py b/tests/modeladmin/test_checks.py index decddee591..acca6b18a2 100644 --- a/tests/modeladmin/test_checks.py +++ b/tests/modeladmin/test_checks.py @@ -366,6 +366,17 @@ class RadioFieldsCheckTests(CheckTestCase): class PrepopulatedFieldsCheckTests(CheckTestCase): + def test_not_list_or_tuple(self): + class TestModelAdmin(ModelAdmin): + prepopulated_fields = {'slug': 'test'} + + self.assertIsInvalid( + TestModelAdmin, ValidationTestModel, + 'The value of \'prepopulated_fields["slug"]\' must be a list ' + 'or tuple.', + 'admin.E029' + ) + def test_not_dictionary(self): class TestModelAdmin(ModelAdmin): prepopulated_fields = () @@ -1130,3 +1141,15 @@ class ListDisplayEditableTests(CheckTestCase): "'list_display_links' is set.", id='admin.E124', ) + + def test_both_list_editable_and_list_display_links(self): + class ProductAdmin(ModelAdmin): + list_editable = ('name',) + list_display = ('name',) + list_display_links = ('name',) + self.assertIsInvalid( + ProductAdmin, ValidationTestModel, + "The value of 'name' cannot be in both 'list_editable' and " + "'list_display_links'.", + id='admin.E123', + ) |