コード例 #1
0
ファイル: tests.py プロジェクト: alosultan/django-protector
 def test_all_permission_owners(self):
     self.user.permissions.add(self.permission)
     self.assertEquals(
         get_all_permission_owners(self.permission).count(), 1
     )
     self.group.permissions.add(self.permission)
     self.group.users.add(self.user2)
     self.assertEquals(
         get_all_permission_owners(self.permission).count(), 2
     )
コード例 #2
0
 def test_all_permission_owners(self):
     self.user2.is_superuser = True
     self.user2.save()
     self.user.permissions.add(self.permission)
     self.assertEquals(
         get_all_permission_owners(self.permission).count(), 1)
     self.group.permissions.add(self.permission)
     self.group.users.add(self.user2)
     self.assertEquals(
         get_all_permission_owners(self.permission).count(), 2)
     self.assertEquals(
         get_all_permission_owners(self.permission2,
                                   include_superuser=True).count(), 1)
コード例 #3
0
ファイル: tests.py プロジェクト: grey0ne/django-protector
 def test_all_permission_owners(self):
     self.user2.is_superuser = True
     self.user2.save()
     self.user.permissions.add(self.permission)
     self.assertEquals(
         get_all_permission_owners(self.permission).count(), 1
     )
     self.group.permissions.add(self.permission)
     self.group.users.add(self.user2)
     self.assertEquals(
         get_all_permission_owners(self.permission).count(), 2
     )
     self.assertEquals(
         get_all_permission_owners(
             self.permission2, include_superuser=True
         ).count(), 1
     )
コード例 #4
0
 def test_all_permission_owners(self):
     self.user2.is_superuser = True
     self.user2.save()
     self.user.permissions.add(self.permission, TEST_REASON, responsible=self.responsible_user)
     self.assertEquals(
         get_all_permission_owners(self.permission).count(), 1
     )
     self.group.permissions.add(self.permission, TEST_REASON, responsible=self.responsible_user)
     self.group.users.add(self.user2, TEST_REASON, responsible=self.responsible_user)
     self.assertEquals(
         get_all_permission_owners(self.permission).count(), 2
     )
     self.assertEquals(
         get_all_permission_owners(
             self.permission2, include_superuser=True
         ).count(), 1
     )
     self.assertEqual(self.HistoryOwnerToPermission.objects.count(), 2)
     # as we create generic group to user himself
     self.assertEqual(self.HistoryGenericUserToGroup.objects.count(), 2)