mirror of
https://github.com/django/django.git
synced 2025-10-25 14:46:09 +00:00
Fixed #14795 -- Ensure that get_all_permissions() returns the right result (i.e., all permissions) for superusers. Thanks to jay.halleaux@gmail.com for the report, and Brett Haydon for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14797 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -15,6 +15,7 @@ class BackendTest(TestCase):
|
||||
self.curr_auth = settings.AUTHENTICATION_BACKENDS
|
||||
settings.AUTHENTICATION_BACKENDS = (self.backend,)
|
||||
User.objects.create_user('test', 'test@example.com', 'test')
|
||||
User.objects.create_superuser('test2', 'test2@example.com', 'test')
|
||||
|
||||
def tearDown(self):
|
||||
settings.AUTHENTICATION_BACKENDS = self.curr_auth
|
||||
@@ -90,6 +91,10 @@ class BackendTest(TestCase):
|
||||
self.assertEqual(user.has_perm('auth.test'), True)
|
||||
self.assertEqual(user.get_all_permissions(), set(['auth.test']))
|
||||
|
||||
def test_get_all_superuser_permissions(self):
|
||||
"A superuser has all permissions. Refs #14795"
|
||||
user = User.objects.get(username='test2')
|
||||
self.assertEqual(len(user.get_all_permissions()), len(Permission.objects.all()))
|
||||
|
||||
class TestObj(object):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user