Fixed test failures from 98e8da3709.

This commit is contained in:
Florian Apolloner 2014-08-04 16:54:43 +02:00
parent 8193a46c6e
commit 6d256ae248
1 changed files with 8 additions and 4 deletions

View File

@ -373,7 +373,8 @@ class ListFiltersTests(TestCase):
# Make sure that all users are present in the author's list filter
filterspec = changelist.get_filters(request)[0][1]
self.assertEqual(filterspec.lookup_choices, [(1, 'alfred'), (2, 'bob'), (3, 'lisa')])
expected = [(self.alfred.pk, 'alfred'), (self.bob.pk, 'bob'), (self.lisa.pk, 'lisa')]
self.assertEqual(filterspec.lookup_choices, expected)
request = self.request_factory.get('/', {'author__isnull': 'True'})
changelist = self.get_changelist(request, Book, modeladmin)
@ -408,7 +409,8 @@ class ListFiltersTests(TestCase):
# Make sure that all users are present in the contrib's list filter
filterspec = changelist.get_filters(request)[0][2]
self.assertEqual(filterspec.lookup_choices, [(1, 'alfred'), (2, 'bob'), (3, 'lisa')])
expected = [(self.alfred.pk, 'alfred'), (self.bob.pk, 'bob'), (self.lisa.pk, 'lisa')]
self.assertEqual(filterspec.lookup_choices, expected)
request = self.request_factory.get('/', {'contributors__isnull': 'True'})
changelist = self.get_changelist(request, Book, modeladmin)
@ -495,7 +497,8 @@ class ListFiltersTests(TestCase):
# Make sure that only actual authors are present in author's list filter
filterspec = changelist.get_filters(request)[0][4]
self.assertEqual(filterspec.lookup_choices, [(1, 'alfred'), (2, 'bob')])
expected = [(self.alfred.pk, 'alfred'), (self.bob.pk, 'bob')]
self.assertEqual(filterspec.lookup_choices, expected)
def test_relatedonlyfieldlistfilter_manytomany(self):
modeladmin = BookAdminRelatedOnlyFilter(Book, site)
@ -505,7 +508,8 @@ class ListFiltersTests(TestCase):
# Make sure that only actual contributors are present in contrib's list filter
filterspec = changelist.get_filters(request)[0][5]
self.assertEqual(filterspec.lookup_choices, [(2, 'bob'), (3, 'lisa')])
expected = [(self.bob.pk, 'bob'), (self.lisa.pk, 'lisa')]
self.assertEqual(filterspec.lookup_choices, expected)
def test_booleanfieldlistfilter(self):
modeladmin = BookAdmin(Book, site)