def test_knows_that_an_inactive_user_has_no_permissions(self):
     # Setup
     user = UserFactory.create(is_active=False)
     checker = ForumPermissionChecker(user)
     # Run & check
     assert not checker.has_perm('can_see_forum', self.forum)
     assert not checker.has_perm('can_read_forum', self.forum)
     assert checker.get_perms(self.forum) == []
Example #2
0
 def test_knows_that_an_inactive_user_has_no_permissions(self):
     # Setup
     user = UserFactory.create(is_active=False)
     checker = ForumPermissionChecker(user)
     # Run & check
     assert not checker.has_perm('can_see_forum', self.forum)
     assert not checker.has_perm('can_read_forum', self.forum)
     assert checker.get_perms(self.forum) == []
 def test_knows_that_a_superuser_has_all_the_permissions(self):
     # Setup
     user = UserFactory.create(is_active=True, is_superuser=True)
     checker = ForumPermissionChecker(user)
     # Run & check
     assert checker.has_perm('can_see_forum', self.forum)
     assert checker.has_perm('can_read_forum', self.forum)
     assert checker.get_perms(self.forum) == \
         list(ForumPermission.objects.values_list('codename', flat=True))
Example #4
0
 def test_knows_that_a_superuser_has_all_the_permissions(self):
     # Setup
     user = UserFactory.create(is_active=True, is_superuser=True)
     checker = ForumPermissionChecker(user)
     # Run & check
     assert checker.has_perm('can_see_forum', self.forum)
     assert checker.has_perm('can_read_forum', self.forum)
     assert checker.get_perms(self.forum) == \
         list(ForumPermission.objects.values_list('codename', flat=True))