From 453915bb1272c9a9189a741e6a9b9246edfcbd03 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 9 Aug 2013 10:57:25 -0400 Subject: [PATCH] SQLite test fix -- refs #9057 --- django/contrib/auth/tests/test_management.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/django/contrib/auth/tests/test_management.py b/django/contrib/auth/tests/test_management.py index 3711f52dea..91a6a589c1 100644 --- a/django/contrib/auth/tests/test_management.py +++ b/django/contrib/auth/tests/test_management.py @@ -239,21 +239,22 @@ class PermissionTestCase(TestCase): create_permissions(models, [], verbosity=0) def test_default_permissions(self): + permission_content_type = ContentType.objects.get_by_natural_key('auth', 'permission') models.Permission._meta.permissions = [ ('my_custom_permission', 'Some permission'), ] create_permissions(models, [], verbosity=0) # add/change/delete permission by default + custom permission - self.assertEqual(models.Permission.objects.filter(content_type= - ContentType.objects.get_by_natural_key('auth', 'permission') + self.assertEqual(models.Permission.objects.filter( + content_type=permission_content_type, ).count(), 4) - models.Permission.objects.all().delete() + models.Permission.objects.filter(content_type=permission_content_type).delete() models.Permission._meta.default_permissions = [] create_permissions(models, [], verbosity=0) # custom permission only since default permissions is empty - self.assertEqual(models.Permission.objects.filter(content_type= - ContentType.objects.get_by_natural_key('auth', 'permission') + self.assertEqual(models.Permission.objects.filter( + content_type=permission_content_type, ).count(), 1)