Added tests for pull-request #386

1. Custom views should be prepended to the 'views' list, otherwise they
   could be shadowed by views of the superclass.
2. Custom views should not be added to the superclass 'views' list.
   Instead a new list should be created and assigned to the class.
This commit is contained in:
Germano Gabbianelli 2013-12-05 12:48:55 +01:00
parent 4c35c506a7
commit 606db2fe7a

View file

@ -53,10 +53,11 @@ class ModelAdminTest(TestCase):
self.model_admin = MyModelAdmin
def test_views(self):
self.assertIn(
self.model_admin.my_view,
self.model_admin.views
)
views = [self.model_admin.my_view] + ModelAdmin2.views
self.assertListEqual(self.model_admin.views, views)
def test_views_not_same(self):
self.assertIsNot(self.model_admin.views, ModelAdmin2.views)
def test_get_index_kwargs(self):
admin_instance = ModelAdmin2(Thing, Admin2)