From 606db2fe7ae15b7952b3a3e486db13c20efb2fb0 Mon Sep 17 00:00:00 2001 From: Germano Gabbianelli Date: Thu, 5 Dec 2013 12:48:55 +0100 Subject: [PATCH] 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. --- djadmin2/tests/test_types.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/djadmin2/tests/test_types.py b/djadmin2/tests/test_types.py index 288fd97..d95f1b5 100644 --- a/djadmin2/tests/test_types.py +++ b/djadmin2/tests/test_types.py @@ -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)