Esempio n. 1
0
 def test_no_perm_thread_delete(self):
     """User not in group cannot delete thread in any forum."""
     self.context['request'].user = UserFactory()
     assert not has_perm(self.context, 'forums_forum.thread_delete_forum',
                         self.forum_1)
     assert not has_perm(self.context, 'forums_forum.thread_delete_forum',
                         self.forum_2)
Esempio n. 2
0
 def test_no_perm_thread_delete(self):
     """User not in group cannot delete thread in any forum."""
     self.context['request'].user = user(save=True)
     assert not has_perm(self.context, 'forums_forum.thread_delete_forum',
                         self.forum_1)
     assert not has_perm(self.context, 'forums_forum.thread_delete_forum',
                         self.forum_2)
Esempio n. 3
0
    def test_has_perm_post_edit(self):
        """User in group can edit any post in forum_1, but not in forum_2."""
        u = UserFactory()
        self.group.user_set.add(u)

        self.context['request'].user = u
        assert has_perm(self.context, 'forums_forum.post_edit_forum',
                        self.forum_1)
        assert not has_perm(self.context, 'forums_forum.post_edit_forum',
                            self.forum_2)
Esempio n. 4
0
    def test_has_perm_thread_delete(self):
        """User in group can delete thread in forum_1, but not in forum_2."""
        u = UserFactory()
        self.group.user_set.add(u)

        self.context['request'].user = u
        assert has_perm(self.context, 'forums_forum.thread_delete_forum',
                        self.forum_1)
        assert not has_perm(self.context, 'forums_forum.thread_delete_forum',
                            self.forum_2)
Esempio n. 5
0
    def test_has_perm_thread_edit(self):
        """User in group can edit thread in forum_1, but not in forum_2."""
        u = user(save=True)
        self.group.user_set.add(u)

        self.context['request'].user = u
        assert has_perm(self.context, 'forums_forum.thread_edit_forum',
                        self.forum_1)
        assert not has_perm(self.context, 'forums_forum.thread_edit_forum',
                            self.forum_2)
Esempio n. 6
0
    def test_has_perm_post_delete(self):
        """User in group can delete posts in forum_1, but not in forum_2."""
        u = user(save=True)
        self.group.user_set.add(u)

        self.context['request'].user = u
        assert has_perm(self.context, 'forums_forum.post_delete_forum',
                        self.forum_1)
        assert not has_perm(self.context, 'forums_forum.post_delete_forum',
                            self.forum_2)
Esempio n. 7
0
    def test_has_perm_post_edit(self):
        """User in group can edit any post in forum_1, but not in forum_2."""
        u = user(save=True)
        self.group.user_set.add(u)

        self.context['request'].user = u
        assert has_perm(self.context, 'forums_forum.post_edit_forum',
                        self.forum_1)
        assert not has_perm(self.context, 'forums_forum.post_edit_forum',
                            self.forum_2)
Esempio n. 8
0
    def test_has_perm_thread_delete(self):
        """User in group can delete thread in forum_1, but not in forum_2."""
        u = user(save=True)
        self.group.user_set.add(u)

        self.context['request'].user = u
        assert has_perm(self.context, 'forums_forum.thread_delete_forum',
                        self.forum_1)
        assert not has_perm(self.context, 'forums_forum.thread_delete_forum',
                            self.forum_2)
Esempio n. 9
0
    def test_has_perm_thread_sticky(self):
        # User in group can change sticky status of thread in forum_1,
        # but not in forum_2.
        u = UserFactory()
        self.group.user_set.add(u)

        self.context['request'].user = u
        assert has_perm(self.context, 'forums_forum.thread_sticky_forum',
                        self.forum_1)
        assert not has_perm(self.context, 'forums_forum.thread_sticky_forum',
                            self.forum_2)
Esempio n. 10
0
    def test_has_perm_thread_sticky(self):
        # User in group can change sticky status of thread in forum_1,
        # but not in forum_2.
        u = user(save=True)
        self.group.user_set.add(u)

        self.context['request'].user = u
        assert has_perm(self.context, 'forums_forum.thread_sticky_forum',
                        self.forum_1)
        assert not has_perm(self.context, 'forums_forum.thread_sticky_forum',
                            self.forum_2)
Esempio n. 11
0
    def test_has_perm_thread_locked(self):
        # Sanity check: user in group has no permission to change
        # locked status in forum_1.
        u = UserFactory()
        self.group.user_set.add(u)

        self.context['request'].user = u
        assert not has_perm(self.context, 'forums_forum.thread_locked_forum',
                            self.forum_1)
Esempio n. 12
0
    def test_has_perm_thread_locked(self):
        # Sanity check: user in group has no permission to change
        # locked status in forum_1.
        u = user(save=True)
        self.group.user_set.add(u)

        self.context['request'].user = u
        assert not has_perm(self.context, 'forums_forum.thread_locked_forum',
                            self.forum_1)