Example #1
0
 def test_cannot_be_saved_without_forum_if_the_permission_is_not_global(
         self):
     # Run & check
     with pytest.raises(ValidationError):
         perm = ForumPermissionFactory.create(is_global=False)
         user_perm = UserForumPermissionFactory.build(permission=perm)
         user_perm.clean()
Example #2
0
 def test_cannot_be_saved_without_forum_if_the_permission_is_not_global(self):
     # Run & check
     with pytest.raises(ValidationError):
         perm = ForumPermissionFactory.create(is_global=False)
         user_perm = UserForumPermissionFactory.build(
             permission=perm)
         user_perm.clean()
Example #3
0
 def test_cannot_target_an_anonymous_user_and_a_registered_user(self):
     # Setup
     user = UserFactory.create()
     # Run & check
     with pytest.raises(ValidationError):
         perm = ForumPermissionFactory.create(is_local=True, is_global=True)
         user_perm = UserForumPermissionFactory.build(
             permission=perm, user=user, anonymous_user=True)
         user_perm.clean()
Example #4
0
 def test_cannot_be_cleaned_without_local_or_global_flag(self):
     # Run & check
     with pytest.raises(ValidationError):
         perm = ForumPermissionFactory.build(is_local=False,
                                             is_global=False)
         perm.clean()
Example #5
0
 def test_cannot_be_cleaned_without_local_or_global_flag(self):
     # Run & check
     with pytest.raises(ValidationError):
         perm = ForumPermissionFactory.build(is_local=False, is_global=False)
         perm.clean()