1
0
mirror of https://github.com/django/django.git synced 2024-12-23 09:36:06 +00:00

Added sorting to some admin_view tests to prevent transient failures; refs #23380.

This commit is contained in:
Tim Graham 2014-09-08 17:10:58 -04:00
parent 16548cfc7c
commit d3543af750

View File

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