Kaydet (Commit) 1ae64e96 authored tarafından Luke Plant's avatar Luke Plant

Fixed a dependence on set-ordering in tests

üst c31c2c92
......@@ -83,11 +83,11 @@ class DepartmentListFilterLookupWithNonStringValue(SimpleListFilter):
parameter_name = 'department'
def lookups(self, request, model_admin):
return set([
return sorted(set([
(employee.department.id, # Intentionally not a string (Refs #19318)
employee.department.code)
for employee in model_admin.queryset(request).all()
])
]))
def queryset(self, request, queryset):
if self.value():
......@@ -683,9 +683,9 @@ class ListFiltersTests(TestCase):
filterspec = changelist.get_filters(request)[0][-1]
self.assertEqual(force_text(filterspec.title), 'department')
choices = list(filterspec.choices(changelist))
self.assertEqual(choices[2]['display'], 'DEV')
self.assertEqual(choices[2]['selected'], True)
self.assertEqual(choices[2]['query_string'], '?department=%s' % self.john.pk)
self.assertEqual(choices[1]['display'], 'DEV')
self.assertEqual(choices[1]['selected'], True)
self.assertEqual(choices[1]['query_string'], '?department=%s' % self.john.pk)
def test_fk_with_to_field(self):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment