SQLite test fix -- refs #9057
This commit is contained in:
parent
ddae74b64c
commit
453915bb12
|
@ -239,21 +239,22 @@ class PermissionTestCase(TestCase):
|
||||||
create_permissions(models, [], verbosity=0)
|
create_permissions(models, [], verbosity=0)
|
||||||
|
|
||||||
def test_default_permissions(self):
|
def test_default_permissions(self):
|
||||||
|
permission_content_type = ContentType.objects.get_by_natural_key('auth', 'permission')
|
||||||
models.Permission._meta.permissions = [
|
models.Permission._meta.permissions = [
|
||||||
('my_custom_permission', 'Some permission'),
|
('my_custom_permission', 'Some permission'),
|
||||||
]
|
]
|
||||||
create_permissions(models, [], verbosity=0)
|
create_permissions(models, [], verbosity=0)
|
||||||
|
|
||||||
# add/change/delete permission by default + custom permission
|
# add/change/delete permission by default + custom permission
|
||||||
self.assertEqual(models.Permission.objects.filter(content_type=
|
self.assertEqual(models.Permission.objects.filter(
|
||||||
ContentType.objects.get_by_natural_key('auth', 'permission')
|
content_type=permission_content_type,
|
||||||
).count(), 4)
|
).count(), 4)
|
||||||
|
|
||||||
models.Permission.objects.all().delete()
|
models.Permission.objects.filter(content_type=permission_content_type).delete()
|
||||||
models.Permission._meta.default_permissions = []
|
models.Permission._meta.default_permissions = []
|
||||||
create_permissions(models, [], verbosity=0)
|
create_permissions(models, [], verbosity=0)
|
||||||
|
|
||||||
# custom permission only since default permissions is empty
|
# custom permission only since default permissions is empty
|
||||||
self.assertEqual(models.Permission.objects.filter(content_type=
|
self.assertEqual(models.Permission.objects.filter(
|
||||||
ContentType.objects.get_by_natural_key('auth', 'permission')
|
content_type=permission_content_type,
|
||||||
).count(), 1)
|
).count(), 1)
|
||||||
|
|
Loading…
Reference in New Issue