Exemplo n.º 1
0
 def test_allow_editing(self):
     p = self.__create_testpost()
     # I know we can edit it, since we are the original author ..
     self.failUnless(p.allow_editing())
     p.author = testutils.get_superuser()
     p.save()
     # Now we must not have edit permission
     self.failIf(p.allow_editing())
     self.__add_user_to_role(self.c)
     self.__assign_flag('sphboard_editallposts')
     self.failUnless(p.allow_editing())
Exemplo n.º 2
0
 def test_allow_editing(self):
     p = self.__create_testpost()
     # I know we can edit it, since we are the original author ..
     self.failUnless(p.allow_editing())
     p.author = testutils.get_superuser()
     p.save()
     # Now we must not have edit permission
     self.failIf(p.allow_editing())
     self.__add_user_to_role( self.c )
     self.__assign_flag( 'sphboard_editallposts' )
     self.failUnless(p.allow_editing())
Exemplo n.º 3
0
    def setUp(self):
        """
            We have 2 categories cat1 and cat2 and 2 threads (total 4 posts):

              cat1/                  -- category cat1
                 cat1_p1             -- thread/post c1_p1 in category cat1
                   cat1_p2           -- post c1_p2 in thread cat1_p1
                   cat1_p3           -- post c1_p3 in thread cat1_p1
              cat2/                  -- category cat2
                 cat2_p1             -- thread/post cat2_p1 in category cat2
        """
        self.testuser = testutils.get_testuser()
        self.superuser = testutils.get_superuser()
        self.testgroup = testutils.get_testgroup()
        testutils.setup_threadlocals(self.testuser, self.testgroup)

        # Setup test role ..
        self.testrole = testutils.get_testrole()

        # Test category 1
        self.cat1 = Category(name='Category 1',
                             allowview=3,
                             allowreplies=3,
                             allowthreads=3,
                             group=self.testgroup)
        self.cat1.save()

        self.cat2 = Category(name='Category 2',
                             allowview=3,
                             allowreplies=3,
                             allowthreads=3,
                             group=self.testgroup)
        self.cat2.save()

        # create thread 1 in category c1
        self.cat1_p1 = Post(category=self.cat1,
                            subject='Post p1 in category c1',
                            body="post 1",
                            markup='bbcode',
                            author=self.testuser)
        self.cat1_p1.save()

        self.cat1_p2 = Post(category=self.cat1,
                            subject='Post p2 in category c1',
                            body="post 2",
                            markup='bbcode',
                            thread=self.cat1_p1,
                            author=self.testuser)
        self.cat1_p2.save()

        self.cat1_p3 = Post(category=self.cat1,
                            subject='Post p3 in category c1',
                            body="post 3",
                            markup='bbcode',
                            thread=self.cat1_p1,
                            author=self.testuser)
        self.cat1_p3.save()

        # create thread 2 in category cat2
        self.cat2_p1 = Post(category=self.cat2,
                            subject='Post p1 in category cat2',
                            body="post 1",
                            markup='bbcode',
                            author=self.testuser)
        self.cat2_p1.save()

        # log in the user
        logged_in = self.client.login(username='******',
                                      password='******')
Exemplo n.º 4
0
    def setUp(self):
        """
            We have 2 categories cat1 and cat2 and 2 threads (total 4 posts):

              cat1/                  -- category cat1
                 cat1_p1             -- thread/post c1_p1 in category cat1
                   cat1_p2           -- post c1_p2 in thread cat1_p1
                   cat1_p3           -- post c1_p3 in thread cat1_p1
              cat2/                  -- category cat2
                 cat2_p1             -- thread/post cat2_p1 in category cat2
        """
        self.testuser = testutils.get_testuser()
        self.superuser = testutils.get_superuser()
        self.testgroup = testutils.get_testgroup()
        testutils.setup_threadlocals(self.testuser, self.testgroup)

        # Setup test role ..
        self.testrole = testutils.get_testrole()

        # Test category 1
        self.cat1 = Category(name = 'Category 1',
                          allowview = 3,
                          allowreplies = 3,
                          allowthreads = 3,
                          group = self.testgroup)
        self.cat1.save()

        self.cat2 = Category(name = 'Category 2',
                          allowview = 3,
                          allowreplies = 3,
                          allowthreads = 3,
                          group = self.testgroup)
        self.cat2.save()

        # create thread 1 in category c1
        self.cat1_p1 = Post(category = self.cat1,
                          subject = 'Post p1 in category c1',
                          body = "post 1",
                          markup = 'bbcode',
                          author = self.testuser)
        self.cat1_p1.save()

        self.cat1_p2 = Post(category = self.cat1,
                          subject = 'Post p2 in category c1',
                          body = "post 2",
                          markup = 'bbcode',
                          thread = self.cat1_p1,
                          author = self.testuser)
        self.cat1_p2.save()

        self.cat1_p3 = Post(category = self.cat1,
                          subject = 'Post p3 in category c1',
                          body = "post 3",
                          markup = 'bbcode',
                          thread = self.cat1_p1,
                          author = self.testuser)
        self.cat1_p3.save()

        # create thread 2 in category cat2
        self.cat2_p1 = Post(category = self.cat2,
                          subject = 'Post p1 in category cat2',
                          body = "post 1",
                          markup = 'bbcode',
                          author = self.testuser)
        self.cat2_p1.save()

        # log in the user
        logged_in = self.client.login(username='******', password='******')