Пример #1
0
 def test_has_perm_or_owns_thread_edit(self):
     """Users can edit their own threads."""
     my_t = thread(save=True)
     me = my_t.creator
     other_t = thread(save=True)
     self.context['request'].user = me
     perm = 'forums_forum.thread_edit_forum'
     assert has_perm_or_owns(self.context, perm, my_t, self.forum_1)
     assert not has_perm_or_owns(self.context, perm, other_t, self.forum_1)
Пример #2
0
 def test_has_perm_or_owns_thread_edit(self):
     """Users can edit their own threads."""
     my_t = thread(save=True)
     me = my_t.creator
     other_t = thread(save=True)
     self.context['request'].user = me
     perm = 'forums_forum.thread_edit_forum'
     assert has_perm_or_owns(self.context, perm, my_t, self.forum_1)
     assert not has_perm_or_owns(self.context, perm, other_t, self.forum_1)
Пример #3
0
 def test_has_perm_or_owns_thread_edit(self):
     """
     User in ForumsModerator group can edit thread in forum_1, but not in
     forum_2.
     """
     me = User.objects.get(pk=118533)
     my_t = Thread.objects.filter(creator=me)[0]
     other_t = Thread.objects.exclude(creator=me)[0]
     self.context['request'].user = me
     perm = 'forums_forum.thread_edit_forum'
     assert has_perm_or_owns(self.context, perm, my_t, self.forum_1)
     assert not has_perm_or_owns(self.context, perm, other_t, self.forum_1)