plone.app.discussion/plone/app/discussion/tests/test_moderation_view.py
2009-06-18 20:57:47 +00:00

56 lines
1.8 KiB
Python

import unittest
from datetime import datetime, timedelta
from plone.registry import Registry
from zope.component import createObject
from Acquisition import aq_base, aq_parent, aq_inner
from OFS.Image import Image
from plone.app.vocabularies.types import BAD_TYPES
from Products.CMFCore.FSImage import FSImage
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.tests import dummy
from Products.PloneTestCase.ptc import PloneTestCase
from plone.app.discussion.browser.moderation import View
from plone.app.discussion.interfaces import IConversation, IComment, IReplies, IDiscussionSettings
from plone.app.discussion.tests.layer import DiscussionLayer
class ModerationViewTest(PloneTestCase):
layer = DiscussionLayer
def afterSetUp(self):
self.loginAsPortalOwner()
typetool = self.portal.portal_types
typetool.constructContent('Document', self.portal, 'doc1')
self.portal_discussion = getToolByName(self.portal, 'portal_discussion', None)
self.membership_tool = getToolByName(self.folder, 'portal_membership')
self.memberdata = self.portal.portal_memberdata
request = self.app.REQUEST
context = getattr(self.portal, 'doc1')
self.view = View(context, request)
def test_comments_pending_review(self):
# Add a conversation with a comment and two replies
conversation = IConversation(self.portal.doc1)
comment = createObject('plone.Comment')
comment.title = 'Comment 1'
comment.text = 'Comment text'
comment.Creator = 'Jim'
comment.author_username = 'jim'
new_id = conversation.addComment(comment)
self.view.comments_pending_review()
# Todo
def test_suite():
return unittest.defaultTestLoader.loadTestsFromName(__name__)