diff --git a/wagtail/contrib/modeladmin/tests/test_page_modeladmin.py b/wagtail/contrib/modeladmin/tests/test_page_modeladmin.py index eeac0f2f9..219802d8b 100644 --- a/wagtail/contrib/modeladmin/tests/test_page_modeladmin.py +++ b/wagtail/contrib/modeladmin/tests/test_page_modeladmin.py @@ -157,9 +157,15 @@ class TestInspectView(TestCase, WagtailTestUtils): response = self.get(100) self.assertEqual(response.status_code, 404) - def test_label_display(self): + def test_short_description_is_used_as_field_label(self): + """ + A custom field has been added to the inspect view's `inspect_view_fields` and since + this field has a `short_description` we expect it to be used as the field's label, + and not use the name of the function. + """ response = self.client.get('/admin/modeladmintest/author/inspect/1/') self.assertContains(response, 'Birth information') + self.assertNotContains(response, 'author_birth_string') class TestEditView(TestCase, WagtailTestUtils): diff --git a/wagtail/contrib/modeladmin/tests/test_simple_modeladmin.py b/wagtail/contrib/modeladmin/tests/test_simple_modeladmin.py index 4845ea667..c23e47160 100644 --- a/wagtail/contrib/modeladmin/tests/test_simple_modeladmin.py +++ b/wagtail/contrib/modeladmin/tests/test_simple_modeladmin.py @@ -222,11 +222,11 @@ class TestInspectView(TestCase, WagtailTestUtils): def test_author_name_present(self): """ - The author name should appear three times. Once in the header, once - in the name field and once more in the birth string + The author name should appear twice. Once in the header, and once + more in the field listing """ response = self.get_for_author(1) - self.assertContains(response, 'J. R. R. Tolkien', 3) + self.assertContains(response, 'J. R. R. Tolkien', 2) def test_author_dob_not_present(self): """ diff --git a/wagtail/tests/modeladmintest/models.py b/wagtail/tests/modeladmintest/models.py index 11e9ccd16..fbd7b3ff7 100644 --- a/wagtail/tests/modeladmintest/models.py +++ b/wagtail/tests/modeladmintest/models.py @@ -10,7 +10,7 @@ class Author(models.Model): date_of_birth = models.DateField() def author_birth_string(self): - return '{} was born in pallet town'.format(self.name) + return 'This author was born in pallet town' author_birth_string.short_description = "Birth information"