Fixed cache state dependence for assertNumQueries in test_group_permission_performance.

Refs #20432 and #23746.
This commit is contained in:
wrwrwr 2014-11-24 20:10:23 +01:00 committed by Tim Graham
parent d66bda6059
commit 7cd3f1c295
1 changed files with 4 additions and 0 deletions

View File

@ -4205,6 +4205,10 @@ class GroupAdminTest(TestCase):
def test_group_permission_performance(self): def test_group_permission_performance(self):
g = Group.objects.create(name="test_group") g = Group.objects.create(name="test_group")
# Ensure no queries are skipped due to cached content type for Group.
ContentType.objects.clear_cache()
with self.assertNumQueries(8): with self.assertNumQueries(8):
response = self.client.get('/test_admin/admin/auth/group/%s/' % g.pk) response = self.client.get('/test_admin/admin/auth/group/%s/' % g.pk)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)