1. Waldemar Kornewald
  2. djangotoolbox

Commits

d3f3nd3r  committed 4f0737b

remove djangotoolbox.contrib.auth.tests.group, django.contrib.auth.tests.auth_backends.BackendTest works with small changes

  • Participants
  • Parent commits 0b4c39f
  • Branches default

Comments (0)

Files changed (2)

File djangotoolbox/contrib/auth/tests/__init__.py

View file
 from djangotoolbox.contrib.auth.tests.tokens import TOKEN_GENERATOR_TESTS
 from djangotoolbox.contrib.auth.tests.models import ProfileTestCase
 
-#from djangotoolbox.contrib.auth.tests.groups import GroupPermissionTest
-
 # The password for the fixture data users is 'password'
 
 __test__ = {

File djangotoolbox/contrib/auth/tests/groups.py

-from django.conf import settings
-from django.contrib.contenttypes.models import ContentType
-from django.test import TestCase
-from djangotoolbox.contrib.auth.models import Group, User, GroupList, Permission, PermissionList
-
-
-class GroupPermissionTest(TestCase):
-
-    backend = 'djangotoolbox.contrib.auth.backends.ModelBackend'
-
-    def setUp(self):
-        self.curr_auth = settings.AUTHENTICATION_BACKENDS
-        settings.AUTHENTICATION_BACKENDS = (self.backend,)
-        User.objects.create_user('test', 'test@example.com', 'test')
-
-    def tearDown(self):
-        settings.AUTHENTICATION_BACKENDS = self.curr_auth
-
-    def test_group_perms(self):
-        user = User.objects.get(username='test')
-        group = Group.objects.create(name='test_group')
-        
-        user.group_list.groups.append(group.id)
-        user.save()
-        
-        content_type=ContentType.objects.get_for_model(User)
-        perm = Permission.objects.create(name='test_group', content_type=content_type, codename='test_group')
-  
-        group.permissions.permissions.append(perm.id)
-        group.permissions.save()
-        group.save()
-        self.assertEqual(user.get_group_permissions(), set([u'auth.test_group']))
-
-        """
-        content_type=ContentType.objects.get_for_model(ContentType)
-        print(content_type)
-        perm = Permission.objects.create(name='test_group1', content_type=content_type, codename='test_group1')
-        group.permissions.permissions.append(perm.id)
-        group.permissions.save()
-        group.save()
-        self.assertEqual(user.get_group_permissions(), set([u'contenttypes.test_group', u'auth.test_group']))
-        """
-        
-        perm = Permission.objects.create(name='perm1', content_type=content_type, codename='perm1')
-        user.user_permissions.permissions.append(perm.id)
-        user.save()
-
-        #self.assertEqual(user.has_perm('contenttypes.perm1'),True)
-        #self.assertEqual(user.get_all_permissions(), set([u'contenttypes.perm1', u'contenttypes.test_group', u'auth.test_group']))