Ejemplo n.º 1
0
    def test_main_user_remove_post(self):
        self.request_login('*****@*****.**')
        self.assertEqual(Thread.objects.get(id=self.thread.id).posts_count, 3)
        self.assertEqual(SubCategory.objects.get(id=self.subcategory.id).posts_count, 5)

        self.check_ajax_ok(self.client.post(url('forum:posts:delete', self.post.id)))
        self.assertTrue(PostPrototype.get_by_id(self.post.id).is_removed)

        # check if edit & remove buttons has dissapeared
        self.check_html_ok(self.request_html(url('forum:threads:show', self.thread.id)), texts=[('pgf-remove-post-button', 2),
                                                                                                         ('pgf-change-post-button', 2)])
Ejemplo n.º 2
0
    def test_main_user_remove_post(self):
        self.request_login('*****@*****.**')
        self.assertEqual(Thread.objects.get(id=self.thread.id).posts_count, 3)
        self.assertEqual(
            SubCategory.objects.get(id=self.subcategory.id).posts_count, 5)

        self.check_ajax_ok(
            self.client.post(url('forum:posts:delete', self.post.id)))
        self.assertTrue(PostPrototype.get_by_id(self.post.id).is_removed)

        # check if edit & remove buttons has dissapeared
        self.check_html_ok(self.request_html(
            url('forum:threads:show', self.thread.id)),
                           texts=[('pgf-remove-post-button', 2),
                                  ('pgf-change-post-button', 2)])
Ejemplo n.º 3
0
    def process(self):
        from the_tale.forum.prototypes import PostPrototype, SubscriptionPrototype

        post = PostPrototype.get_by_id(self.post_id)

        if post is None:
            return True # post can be removed by admins or with removed thread

        accounts = SubscriptionPrototype.get_accounts_for_thread(post.thread)

        subject = '«Сказка»: %s' % post.thread.caption

        context = {'post': post}

        html_content = jinja2.render(self.EMAIL_HTML_TEMPLATE, context)
        text_content = jinja2.render(self.EMAIL_TEXT_TEMPLATE, context)

        return logic.send_mail(accounts, subject, text_content, html_content)
Ejemplo n.º 4
0
    def process(self):
        from the_tale.forum.prototypes import PostPrototype, SubscriptionPrototype

        post = PostPrototype.get_by_id(self.post_id)

        if post is None:
            return True # post can be removed by admins or with removed thread

        accounts = SubscriptionPrototype.get_accounts_for_thread(post.thread)

        subject = '«Сказка»: %s' % post.thread.caption

        context = {'post': post}

        html_content = jinja2.render(self.EMAIL_HTML_TEMPLATE, context)
        text_content = jinja2.render(self.EMAIL_TEXT_TEMPLATE, context)

        return logic.send_mail(accounts, subject, text_content, html_content)