def setUp(self): self.testuser = testutils.get_testuser() self.testgroup = testutils.get_testgroup() testutils.setup_threadlocals(self.testuser, self.testgroup) # Setup test role .. self.testrole = testutils.get_testrole() # Test category # Since we are testing permissions .. revoke all permissions self.c = Category(name = 'Simple Test Category', allowview = 3, allowreplies = 3, allowthreads = 3,) self.c.save()
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='******')
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='******')