Ticket #14795: ticket14795test.diff

File ticket14795test.diff, 1.1 KB (added by Brett Haydon, 14 years ago)
  • django/contrib/auth/tests/auth_backends.py

    index 5dbfab1..823e1e4 100644
    class BackendTest(TestCase):  
    1414        self.curr_auth = settings.AUTHENTICATION_BACKENDS
    1515        settings.AUTHENTICATION_BACKENDS = (self.backend,)
    1616        User.objects.create_user('test', 'test@example.com', 'test')
    17 
     17        user = User.objects.create_user('test2', 'test2@example.com', 'test')
     18        user.is_superuser = True
     19        user.save()
     20       
    1821    def tearDown(self):
    1922        settings.AUTHENTICATION_BACKENDS = self.curr_auth
    2023
    class BackendTest(TestCase):  
    8891        self.assertEqual(user.get_all_permissions('object'), set([]))
    8992        self.assertEqual(user.has_perm('auth.test'), True)
    9093        self.assertEqual(user.get_all_permissions(), set(['auth.test']))
    91 
     94       
     95    def test_get_all_superuser_permissions(self):
     96        """Test for #14795"""
     97        user = User.objects.get(username='test2')
     98        self.assertEqual(len(user.get_all_permissions()),len(Permission.objects.all()))
    9299
    93100class TestObj(object):
    94101    pass
Back to Top