示例#1
0
    def setUp(self):
        self.c = helper.create_category('C1')
        self.b = helper.create_board('B1', 'C1')

        u_helper.create_normal_user('U1')
        self.t = helper.create_thread('T1', 'B1', 'C1')

        self.u = u_helper.get_user_by_username('U1')
示例#2
0
    def setUp(self):
        self.c = helper.create_category('C1')
        self.b = helper.create_board('B1', 'C1')
        self.t = helper.create_thread('T1', 'B1', 'C1')

        u_helper.create_normal_user('U1')
        u_helper.create_normal_user('U2', helper.get_board_by_name('B1'))

        self.p = helper.create_post('P1', 'U1', 'T1', 'B1', 'C1')
        helper.create_post('P2', 'U2', 'T1', 'B1', 'C1')
示例#3
0
    def setUp(self):
        self.c1 = helper.create_category('C1')
        self.b1 = helper.create_board('B1', 'C1')
        self.t1 = helper.create_thread('T1', 'B1', 'C1')

        self.u1 = u_helper.create_normal_user('U1')
        self.u2 = u_helper.create_normal_user('U2')
        self.u3 = u_helper.create_normal_user('U3', self.b1)
        self.s1 = u_helper.create_super_user('U4')

        self.p1 = helper.create_post('P1', 'U1', 'T1', 'B1', 'C1')
示例#4
0
    def test_detail_view_with_two_posts_as_guest(self):
        """
        The thread has two posts and will be visited as guest.
        """
        u_helper.create_normal_user('Gustav')
        helper.create_post('Hi1!', 'Gustav', 'Thread 1', 'News', 'Public')
        helper.create_post('Hi2!', 'Gustav', 'Thread 1', 'News', 'Public')

        response = self.client.get(
            reverse('board:threads-detail',
                    kwargs={'category': 'public',
                            'board': 'news',
                            'pk': str(self.t.pk)}))
        self.assertContains(response, '', status_code=200)
        self.assertEqual(len(response.context['posts']), 2)
        self.assertEqual(response.context['is_moderator'], False)
示例#5
0
 def setUp(self):
     self.u1 = u_helper.create_normal_user('U1')
     self.s1 = u_helper.create_super_user('S1')
     self.g1 = u_helper.create_group('G1')
     self.c1 = helper.create_category('C1')
     self.b1 = helper.create_board('B1', 'C1')
     self.b2 = helper.create_board('B2', 'C1')
示例#6
0
    def setUp(self):
        self.c = helper.create_category('C1')
        self.b = helper.create_board('B1', 'C1')

        self.u = u_helper.create_normal_user('U1')
        self.g = u_helper.create_group('G1')

        self.t = helper.create_thread('T1', 'B1', 'C1')
示例#7
0
    def test_detail_view_with_two_posts_as_moderator(self):
        """
        The thread has two posts and will be visited as logged in member.
        This member is moderator of the related board.
        """
        u_helper.create_normal_user('Gustav', helper.get_board_by_name('News'))
        helper.create_post('Hi1!', 'Gustav', 'Thread 1', 'News', 'Public')
        helper.create_post('Hi2!', 'Gustav', 'Thread 1', 'News', 'Public')

        self.client.force_login(u_helper.get_user_by_username('Gustav'))
        response = self.client.get(
            reverse('board:threads-detail',
                    kwargs={'category': 'public',
                            'board': 'news',
                            'pk': str(self.t.pk)}))
        self.assertContains(response, '', status_code=200)
        self.assertEqual(len(response.context['posts']), 2)
        self.assertEqual(response.context['is_moderator'], True)
示例#8
0
    def setUp(self):
        helper.create_category("C1")
        helper.create_board("B1", "C1")
        helper.create_thread("T1", "B1", "C1")

        u_helper.create_normal_user("U1")
        u_helper.create_normal_user("U2")
        u_helper.create_normal_user("U3", helper.get_board_by_name("B1"))
        u_helper.create_super_user("U4")

        helper.create_post("P1", "U1", "T1", "B1", "C1")
示例#9
0
    def setUp(self):
        helper.create_category("C1")
        helper.create_board("B1", "C1")
        helper.create_thread("T1", "B1", "C1")

        t = helper.get_thread_by_title("T1")
        t.lock_thread()
        t.save()

        u_helper.create_normal_user("U1")  # Owner of the post
        u_helper.create_normal_user("U2")  # Normal user
        u_helper.create_normal_user("U3", helper.get_board_by_name("B1"))
        u_helper.create_super_user("U4")

        helper.create_post("P1", "U1", "T1", "B1", "C1")