コード例 #1
0
ファイル: test_urls.py プロジェクト: Acidburn0zzz/kitsune
    def test_delete_post_belongs_to_thread_and_forum(self):
        # Delete post action - post belongs to thread and thread
        # belongs to forum.
        f = forum(save=True)
        t = thread(forum=f, save=True)
        # Post belongs to a different forum and thread.
        p = forum_post(save=True)
        u = p.author

        # Give the user the permission to delete posts.
        g = group(save=True)
        ct = ContentType.objects.get_for_model(f)
        permission(codename='forums_forum.post_delete_forum',
                   content_type=ct, object_id=p.thread.forum_id, group=g,
                   save=True)
        permission(codename='forums_forum.post_delete_forum',
                   content_type=ct, object_id=f.id, group=g, save=True)
        g.user_set.add(u)

        self.client.login(username=u.username, password='******')

        # Post isn't in the passed forum:
        r = get(self.client, 'forums.delete_post',
                args=[f.slug, p.thread.id, p.id])
        eq_(404, r.status_code)

        # Post isn't in the passed thread:
        r = get(self.client, 'forums.delete_post',
                args=[p.thread.forum.slug, t.id, p.id])
        eq_(404, r.status_code)
コード例 #2
0
ファイル: test_urls.py プロジェクト: Acidburn0zzz/kitsune
    def test_delete_post_belongs_to_thread_and_document(self):
        """
        Delete post action - post belongs to thread and thread belongs to
        forum.
        """
        r = get(self.client, 'wiki.discuss.delete_post',
                args=[self.doc_2.slug, self.thread.id, self.post.id])
        eq_(404, r.status_code)

        r = get(self.client, 'wiki.discuss.delete_post',
                args=[self.doc.slug, self.thread_2.id, self.post.id])
        eq_(404, r.status_code)
コード例 #3
0
ファイル: test_views.py プロジェクト: MarkSchmidty/kitsune
    def test_mods_can_see_spam_details(self):
        self.question.is_spam = True
        self.question.save()

        res = get(self.client, 'questions.details', args=[self.question.id])
        eq_(404, res.status_code)

        u = user(save=True)
        add_permission(u, FlaggedObject, 'can_moderate')
        self.client.login(username=u.username, password='******')

        res = get(self.client, 'questions.details', args=[self.question.id])
        eq_(200, res.status_code)
コード例 #4
0
ファイル: test_templates.py プロジェクト: akatsoulas/kitsune
    def test_num_replies(self):
        """Verify the number of replies label."""
        t = ThreadFactory()

        response = get(self.client, 'forums.posts', args=[t.forum.slug, t.id])
        eq_(200, response.status_code)
        assert '0 Replies' in response.content

        PostFactory(thread=t)
        PostFactory(thread=t)

        response = get(self.client, 'forums.posts', args=[t.forum.slug, t.id])
        eq_(200, response.status_code)
        assert '2 Replies' in response.content
コード例 #5
0
    def test_num_replies(self):
        """Verify the number of replies label."""
        t = forum_post(save=True).thread

        response = get(self.client, 'forums.posts', args=[t.forum.slug, t.id])
        eq_(200, response.status_code)
        assert '0 Replies' in response.content

        forum_post(thread=t, save=True)
        forum_post(thread=t, save=True)

        response = get(self.client, 'forums.posts', args=[t.forum.slug, t.id])
        eq_(200, response.status_code)
        assert '2 Replies' in response.content
コード例 #6
0
ファイル: test_views.py プロジェクト: MarkSchmidty/kitsune
    def test_read_without_permission(self):
        """Listing posts without the view_in_forum permission should 404."""
        rforum = restricted_forum()
        t = thread(forum=rforum, save=True)

        response = get(self.client, 'forums.posts', args=[t.forum.slug, t.id])
        eq_(404, response.status_code)
コード例 #7
0
    def test_canonical_url(self):
        """Verify the canonical URL is set correctly."""
        f = forum(save=True)

        response = get(self.client, 'forums.threads', args=[f.slug])
        eq_('/forums/%s' % f.slug,
            pq(response.content)('link[rel="canonical"]')[0].attrib['href'])
コード例 #8
0
 def test_modal_locale_selected(self):
     """Locale value is selected for upload modal."""
     response = get(self.client, 'gallery.gallery', args=['image'],
                    locale='fr')
     doc = pq(response.content)
     eq_('fr',
         doc('#gallery-upload-image option[selected="selected"]').val())
コード例 #9
0
ファイル: test_views.py プロジェクト: 1234-/kitsune
    def test_read_without_permission(self):
        """Listing posts without the view_in_forum permission should 404."""
        rforum = RestrictedForumFactory()
        t = ThreadFactory(forum=rforum)

        response = get(self.client, 'forums.posts', args=[t.forum.slug, t.id])
        eq_(404, response.status_code)
コード例 #10
0
ファイル: test_views.py プロジェクト: MarkSchmidty/kitsune
 def test_edit_locked_thread_403(self):
     """Editing a locked thread returns 403."""
     t = thread(document=self.doc, creator=self.u, is_locked=True,
                save=True)
     response = get(self.client, 'wiki.discuss.edit_thread',
                    args=[self.doc.slug, t.id])
     eq_(403, response.status_code)
コード例 #11
0
ファイル: test_templates.py プロジェクト: akatsoulas/kitsune
    def test_canonical_url(self):
        """Verify the canonical URL is set correctly."""
        f = ForumFactory()

        response = get(self.client, 'forums.threads', args=[f.slug])
        eq_('%s/en-US/forums/%s' % (settings.CANONICAL_URL, f.slug),
            pq(response.content)('link[rel="canonical"]')[0].attrib['href'])
コード例 #12
0
ファイル: test_marketplace.py プロジェクト: tobbi/kitsune
 def test_account_category_anon(self):
     """Verify the account category page with unauth'd user."""
     self.client.logout()
     response = get(self.client, "questions.marketplace_aaq_category", args=["account"])
     eq_(200, response.status_code)
     doc = pq(response.content)
     # One extra form field (email) in this case.
     eq_(5, len(doc("#question-form li")))
コード例 #13
0
ファイル: test_marketplace.py プロジェクト: 1234-/kitsune
 def test_payments_category(self):
     """Verify the payments category page."""
     response = get(self.client,
                    'questions.marketplace_aaq_category',
                    args=['payments'])
     eq_(200, response.status_code)
     doc = pq(response.content)
     assert 'Paypal Help Center' in doc('div.inner-wrap').text()
コード例 #14
0
    def test_show_new_thread(self):
        """'Post new thread' shows if user has permission to post."""
        f = forum(save=True)
        u = user(save=True)

        self.client.login(username=u.username, password='******')
        response = get(self.client, 'forums.threads', args=[f.slug])
        self.assertContains(response, 'Post a new thread')
コード例 #15
0
    def test_show_reply_fields(self):
        """Reply fields show if user has permission to post."""
        t = forum_post(save=True).thread
        u = user(save=True)

        self.client.login(username=u.username, password='******')
        response = get(self.client, 'forums.posts', args=[t.forum.slug, t.pk])
        self.assertContains(response, 'thread-reply')
コード例 #16
0
ファイル: test_views.py プロジェクト: 1234-/kitsune
    def test_delete_thread_403(self):
        """Deleting a thread without permissions returns 403."""
        t = ThreadFactory()
        u = UserFactory()

        self.client.login(username=u.username, password='******')
        response = get(self.client, 'forums.delete_thread', args=[t.forum.slug, t.id])
        eq_(403, response.status_code)
コード例 #17
0
 def test_image_draft_shows(self):
     """The image draft is loaded for this user."""
     image(is_draft=True, creator=self.u)
     response = get(self.client, 'gallery.gallery', args=['image'])
     eq_(200, response.status_code)
     doc = pq(response.content)
     assert doc('.file.preview img').attr('src').endswith('098f6b.jpg')
     eq_(1, doc('.file.preview img').length)
コード例 #18
0
ファイル: test_templates.py プロジェクト: jayvdb/kitsune
 def test_video_draft_shows(self):
     """The video draft is loaded for this user."""
     video(is_draft=True, creator=self.u)
     response = get(self.client, 'gallery.gallery', args=['image'])
     eq_(200, response.status_code)
     doc = pq(response.content)
     # Preview for all 3 video formats: flv, ogv, webm
     eq_(3, doc('#gallery-upload-video .preview input').length)
コード例 #19
0
ファイル: test_views.py プロジェクト: 1234-/kitsune
    def test_sticky_thread_405(self):
        """Marking a thread sticky with a HTTP GET returns 405."""
        t = ThreadFactory()
        u = UserFactory()

        self.client.login(username=u.username, password='******')
        response = get(self.client, 'forums.sticky_thread', args=[t.forum.slug, t.id])
        eq_(405, response.status_code)
コード例 #20
0
ファイル: test_views.py プロジェクト: 1234-/kitsune
    def test_reply_thread_405(self):
        """Replying to a thread via a GET instead of a POST request."""
        t = ThreadFactory()
        u = UserFactory()

        self.client.login(username=u.username, password='******')
        response = get(self.client, 'forums.reply', args=[t.forum.slug, t.id])
        eq_(405, response.status_code)
コード例 #21
0
ファイル: test_templates.py プロジェクト: 1234-/kitsune
 def test_long_title_truncated_in_crumbs(self):
     """A very long thread title gets truncated in the breadcrumbs"""
     d = DocumentFactory()
     t = ThreadFactory(title='A thread with a very very very very very' * 5, document=d)
     response = get(self.client, 'wiki.discuss.posts', args=[d.slug, t.id])
     doc = pq(response.content)
     crumb = doc('#breadcrumbs li:last-child')
     eq_(crumb.text(), 'A thread with a very very very very ...')
コード例 #22
0
ファイル: test_views.py プロジェクト: 1234-/kitsune
    def test_watch_GET_405(self):
        """Watch forum with HTTP GET results in 405."""
        f = ForumFactory()
        u = UserFactory()

        self.client.login(username=u.username, password='******')
        response = get(self.client, 'forums.watch_forum', args=[f.id])
        eq_(405, response.status_code)
コード例 #23
0
ファイル: test_views.py プロジェクト: MarkSchmidty/kitsune
    def test_read_without_permission(self):
        """Listing threads without the view_in_forum permission should 404.
        """
        rforum = restricted_forum()

        response = get(self.client, 'forums.threads',
                       args=[rforum.slug])
        eq_(404, response.status_code)
コード例 #24
0
ファイル: test_marketplace.py プロジェクト: 1234-/kitsune
 def test_account_category(self):
     """Verify the account category page."""
     response = get(self.client,
                    'questions.marketplace_aaq_category',
                    args=['account'])
     eq_(200, response.status_code)
     doc = pq(response.content)
     eq_(4, len(doc('#question-form li')))
コード例 #25
0
ファイル: test_views.py プロジェクト: MarkSchmidty/kitsune
    def test_weird_list_troubleshooting_info(self):
        """Test the corner case in which 'modifiedPReferences' is in a
        list in troubleshooting data. This is weird, but caused a bug."""
        q = question(save=True)
        q.add_metadata(troubleshooting='["modifiedPreferences"]')

        # This case should not raise an error.
        response = get(self.client, 'questions.details', args=[q.id])
        eq_(200, response.status_code)
コード例 #26
0
    def test_links_nofollow(self):
        """Links posted should have rel=nofollow."""
        p = forum_post(content='linking http://test.org', save=True)
        t = p.thread
        f = t.forum

        response = get(self.client, 'forums.posts', args=[f.slug, t.pk])
        doc = pq(response.content)
        eq_('nofollow', doc('ol.posts div.content a')[0].attrib['rel'])
コード例 #27
0
ファイル: test_views.py プロジェクト: 1234-/kitsune
    def test_edit_locked_thread_403(self):
        """Editing a locked thread returns 403."""
        locked = ThreadFactory(is_locked=True)
        u = locked.creator
        PostFactory(thread=locked, author=u)

        self.client.login(username=u.username, password='******')
        response = get(self.client, 'forums.edit_thread', args=[locked.forum.slug, locked.id])
        eq_(403, response.status_code)
コード例 #28
0
    def test_delete_post_belongs_to_thread_and_document(self):
        """
        Delete post action - post belongs to thread and thread belongs to
        forum.
        """
        r = get(
            self.client,
            "wiki.discuss.delete_post",
            args=[self.doc_2.slug, self.thread.id, self.post.id],
        )
        eq_(404, r.status_code)

        r = get(
            self.client,
            "wiki.discuss.delete_post",
            args=[self.doc.slug, self.thread_2.id, self.post.id],
        )
        eq_(404, r.status_code)
コード例 #29
0
    def test_posts_fr(self):
        """Posts render for [fr] locale."""
        t = forum_post(save=True).thread

        response = get(self.client, 'forums.posts', args=[t.forum.slug, t.id],
                       locale='fr')
        eq_(200, response.status_code)
        eq_('/forums/{f}/{t}'.format(f=t.forum.slug, t=t.id),
            pq(response.content)('link[rel="canonical"]')[0].attrib['href'])
コード例 #30
0
 def test_modal_locale_selected(self):
     """Locale value is selected for upload modal."""
     response = get(self.client,
                    'gallery.gallery',
                    args=['image'],
                    locale='fr')
     doc = pq(response.content)
     eq_('fr',
         doc('#gallery-upload-image option[selected="selected"]').val())
コード例 #31
0
 def test_long_title_truncated_in_crumbs(self):
     """A very long thread title gets truncated in the breadcrumbs"""
     d = DocumentFactory()
     t = ThreadFactory(title='A thread with a very very very very very' * 5,
                       document=d)
     response = get(self.client, 'wiki.discuss.posts', args=[d.slug, t.id])
     doc = pq(response.content)
     crumb = doc('#breadcrumbs li:last-child')
     eq_(crumb.text(), 'A thread with a very very very very ...')
コード例 #32
0
    def test_long_title_truncated_in_crumbs(self):
        """A very long thread title gets truncated in the breadcrumbs"""
        t = thread(title='A thread with a very very long title', save=True)
        forum_post(thread=t, save=True)

        response = get(self.client, 'forums.posts', args=[t.forum.slug, t.id])
        doc = pq(response.content)
        crumb = doc('#breadcrumbs li:last-child')
        eq_(crumb.text(), 'A thread with a very very ...')
コード例 #33
0
ファイル: test_views.py プロジェクト: 1234-/kitsune
    def test_post_delete_403(self):
        """Deleting a post without permissions returns 403."""
        p = PostFactory()
        t = p.thread
        u = UserFactory()

        self.client.login(username=u.username, password='******')
        response = get(self.client, 'forums.delete_post', args=[t.forum.slug, t.id, p.id])
        eq_(403, response.status_code)
コード例 #34
0
    def test_last_post_link_has_post_id(self):
        """Make sure the last post url links to the last post (#post-<id>).
        """
        p = PostFactory()

        response = get(self.client, "forums.forums")
        doc = pq(response.content)
        last_post_link = doc(".forums .last-post a:not(.username)")[0]
        href = last_post_link.attrib["href"]
        eq_(href.split("#")[1], "post-%s" % p.id)
コード例 #35
0
    def test_restricted_is_invisible(self):
        """Forums with restricted view_in permission shouldn't show up."""
        restricted_forum = ForumFactory()
        # Make it restricted.
        ct = ContentType.objects.get_for_model(restricted_forum)
        PermissionFactory(codename='forums_forum.view_in_forum', content_type=ct,
                          object_id=restricted_forum.id)

        response = get(self.client, 'forums.forums')
        self.assertNotContains(response, restricted_forum.slug)
コード例 #36
0
    def test_multi_feed_titling(self):
        """Ensure that titles are being applied properly to feeds."""
        t = thread(save=True)
        forum = t.forum
        post(thread=t, save=True)

        response = get(self.client, 'forums.threads', args=[forum.slug])
        doc = pq(response.content)
        eq_(ThreadsFeed().title(forum),
            doc('link[type="application/atom+xml"]')[0].attrib['title'])
コード例 #37
0
ファイル: test_views.py プロジェクト: thelegend6420/kitsune
    def test_sticky_thread_405(self):
        """Marking a thread sticky with a HTTP GET returns 405."""
        t = forum_post(save=True).thread
        u = user(save=True)

        self.client.login(username=u.username, password='******')
        response = get(self.client,
                       'forums.sticky_thread',
                       args=[t.forum.slug, t.id])
        eq_(405, response.status_code)
コード例 #38
0
ファイル: test_views.py プロジェクト: MShaffar19/kitsune
    def test_move_thread_405(self):
        """Moving a thread via a GET instead of a POST request."""
        t = ThreadFactory()
        u = UserFactory()

        self.client.login(username=u.username, password="******")
        response = get(self.client,
                       "forums.move_thread",
                       args=[t.forum.slug, t.id])
        eq_(405, response.status_code)
コード例 #39
0
    def test_edit_thread_template(self):
        """The edit-thread template should render."""
        t = ThreadFactory()
        creator = t.creator

        self.client.login(username=creator.username, password="******")
        res = get(self.client, "forums.edit_thread", args=[t.forum.slug, t.id])

        doc = pq(res.content)
        eq_(len(doc("form.edit-thread")), 1)
コード例 #40
0
    def test_display_order(self):
        """Verify the display_order is respected."""
        forum1 = forum(display_order=1, save=True)
        forum2 = forum(display_order=2, save=True)

        # forum1 should be listed first
        r = get(self.client, 'forums.forums')
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(forum1.name, doc('ol.forums > li a:first').text())

        forum1.display_order = 3
        forum1.save()

        # forum2 should be listed first
        r = get(self.client, 'forums.forums')
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(forum2.name, doc('ol.forums > li a:first').text())
コード例 #41
0
    def test_last_post_link_has_post_id(self):
        """Make sure the last post url links to the last post (#post-<id>).
        """
        p = forum_post(save=True)

        response = get(self.client, 'forums.forums')
        doc = pq(response.content)
        last_post_link = doc('ol.forums div.last-post a:not(.username)')[0]
        href = last_post_link.attrib['href']
        eq_(href.split('#')[1], 'post-%s' % p.id)
コード例 #42
0
ファイル: test_templates.py プロジェクト: MShaffar19/kitsune
    def test_posts_fr(self):
        """Posts render for [fr] locale."""
        t = ThreadFactory()

        response = get(self.client, "forums.posts", args=[t.forum.slug, t.id], locale="fr")
        eq_(200, response.status_code)
        eq_(
            "{c}/fr/forums/{f}/{t}".format(c=settings.CANONICAL_URL, f=t.forum.slug, t=t.id),
            pq(response.content)('link[rel="canonical"]')[0].attrib["href"],
        )
コード例 #43
0
    def test_edit_thread_403(self):
        """Editing a thread without permissions returns 403."""
        t = ThreadFactory()
        u = UserFactory()

        self.client.login(username=u.username, password='******')
        response = get(self.client,
                       'forums.edit_thread',
                       args=[t.forum.slug, t.id])
        eq_(403, response.status_code)
コード例 #44
0
    def test_edit_thread_template(self):
        """The edit-thread template should render."""
        u = UserFactory()
        self.client.login(username=u.username, password="******")

        t = ThreadFactory(creator=u, is_locked=False)
        res = get(self.client, "wiki.discuss.edit_thread", args=[t.document.slug, t.id])

        doc = pq(res.content)
        eq_(len(doc("form.edit-thread")), 1)
コード例 #45
0
ファイル: test_views.py プロジェクト: thelegend6420/kitsune
    def test_delete_thread_403(self):
        """Deleting a thread without permissions returns 403."""
        t = forum_post(save=True).thread
        u = user(save=True)

        self.client.login(username=u.username, password='******')
        response = get(self.client,
                       'forums.delete_thread',
                       args=[t.forum.slug, t.id])
        eq_(403, response.status_code)
コード例 #46
0
 def test_edit_locked_thread_403(self):
     """Editing a locked thread returns 403."""
     t = thread(document=self.doc,
                creator=self.u,
                is_locked=True,
                save=True)
     response = get(self.client,
                    'wiki.discuss.edit_thread',
                    args=[self.doc.slug, t.id])
     eq_(403, response.status_code)
コード例 #47
0
ファイル: test_views.py プロジェクト: thelegend6420/kitsune
    def test_move_thread_405(self):
        """Moving a thread via a GET instead of a POST request."""
        t = forum_post(save=True).thread
        u = user(save=True)

        self.client.login(username=u.username, password='******')
        response = get(self.client,
                       'forums.move_thread',
                       args=[t.forum.slug, t.id])
        eq_(405, response.status_code)
コード例 #48
0
ファイル: test_views.py プロジェクト: MShaffar19/kitsune
    def test_sticky_thread_405(self):
        """Marking a thread sticky with a HTTP GET returns 405."""
        t = ThreadFactory()
        u = UserFactory()

        self.client.login(username=u.username, password="******")
        response = get(self.client,
                       "forums.sticky_thread",
                       args=[t.forum.slug, t.id])
        eq_(405, response.status_code)
コード例 #49
0
ファイル: test_templates.py プロジェクト: MShaffar19/kitsune
    def test_edit_thread_template(self):
        """The edit-post template should render."""
        p = PostFactory()
        u = p.author

        self.client.login(username=u.username, password="******")
        res = get(self.client, "forums.edit_post", args=[p.thread.forum.slug, p.thread.id, p.id],)

        doc = pq(res.content)
        eq_(len(doc("form.edit-post")), 1)
コード例 #50
0
    def test_last_thread_post_link_has_post_id(self):
        """Make sure the last post url links to the last post (#post-<id>)."""
        t = ThreadFactory()
        last = PostFactory(thread=t)

        response = get(self.client, "forums.threads", args=[t.forum.slug])
        doc = pq(response.content)
        last_post_link = doc(".threads .last-post a:not(.username)")[0]
        href = last_post_link.attrib["href"]
        eq_(href.split("#")[1], "post-%s" % last.id)
コード例 #51
0
ファイル: test_views.py プロジェクト: MShaffar19/kitsune
    def test_delete_thread_403(self):
        """Deleting a thread without permissions returns 403."""
        t = ThreadFactory()
        u = UserFactory()

        self.client.login(username=u.username, password="******")
        response = get(self.client,
                       "forums.delete_thread",
                       args=[t.forum.slug, t.id])
        eq_(403, response.status_code)
コード例 #52
0
    def test_locked_thread_405(self):
        """Marking a thread locked via a GET instead of a POST request."""
        t = ThreadFactory()
        u = UserFactory()

        self.client.login(username=u.username, password='******')
        response = get(self.client,
                       'forums.lock_thread',
                       args=[t.forum.slug, t.id])
        eq_(405, response.status_code)
コード例 #53
0
 def test_links_nofollow(self):
     """Links posted should have rel=nofollow."""
     u = user(save=True)
     t = thread(save=True)
     t.new_post(creator=u, content='linking http://test.org')
     response = get(self.client,
                    'wiki.discuss.posts',
                    args=[t.document.slug, t.pk])
     doc = pq(response.content)
     eq_('nofollow', doc('ol.posts div.content a')[0].attrib['rel'])
コード例 #54
0
ファイル: test_templates.py プロジェクト: sobatica/kitsune
    def test_long_title_truncated_in_crumbs(self):
        """A very long thread title gets truncated in the breadcrumbs"""
        t = thread(title='A thread with a very very very very long title',
                   save=True)
        forum_post(thread=t, save=True)

        response = get(self.client, 'forums.posts', args=[t.forum.slug, t.id])
        doc = pq(response.content)
        crumb = doc('#breadcrumbs li:last-child')
        eq_(crumb.text(), 'A thread with a very very very very ...')
コード例 #55
0
 def test_account_category_anon(self):
     """Verify the account category page with unauth'd user."""
     self.client.logout()
     response = get(self.client,
                    'questions.marketplace_aaq_category',
                    args=['account'])
     eq_(200, response.status_code)
     doc = pq(response.content)
     # One extra form field (email) in this case.
     eq_(5, len(doc('#question-form li')))
コード例 #56
0
    def test_display_order(self):
        """Verify the display_order is respected."""
        forum1 = ForumFactory(display_order=1)
        forum2 = ForumFactory(display_order=2)

        # forum1 should be listed first
        r = get(self.client, "forums.forums")
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(forum1.name, doc(".forums tr a").first().text())

        forum1.display_order = 3
        forum1.save()

        # forum2 should be listed first
        r = get(self.client, "forums.forums")
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(forum2.name, doc(".forums tr a").first().text())
コード例 #57
0
 def test_links_nofollow(self):
     """Links posted should have rel=nofollow."""
     u = UserFactory()
     t = ThreadFactory()
     t.new_post(creator=u, content="linking http://test.org")
     response = get(self.client,
                    "wiki.discuss.posts",
                    args=[t.document.slug, t.pk])
     doc = pq(response.content)
     eq_("nofollow", doc("ol.posts div.content a")[0].attrib["rel"])
コード例 #58
0
 def test_delete_no_session(self):
     """Delete a thread while logged out redirects."""
     r = get(self.client,
             'wiki.discuss.delete_thread',
             kwargs={
                 'document_slug': 'article-title',
                 'thread_id': 1
             })
     assert (settings.LOGIN_URL in r.redirect_chain[0][0])
     eq_(302, r.redirect_chain[0][1])
コード例 #59
0
ファイル: test_posts.py プロジェクト: rootmeb/kitsune
 def test_delete_no_session(self):
     """Delete a thread while logged out redirects."""
     r = get(self.client,
             'forums.delete_thread',
             kwargs={
                 'forum_slug': 'test-forum',
                 'thread_id': 1
             })
     assert (settings.LOGIN_URL in r.redirect_chain[0][0])
     eq_(302, r.redirect_chain[0][1])
コード例 #60
0
    def test_edit_thread_template(self):
        """The edit-thread template should render."""
        t = forum_post(save=True).thread
        creator = t.creator

        self.client.login(username=creator.username, password='******')
        res = get(self.client, 'forums.edit_thread', args=[t.forum.slug, t.id])

        doc = pq(res.content)
        eq_(len(doc('form.edit-thread')), 1)