remove all the unnecessary acquisition wrapping of conversation (since the conversationAdapterFactory now returns an aq wrapped conversation).

svn path=/plone.app.discussion/trunk/; revision=27501
This commit is contained in:
Timo Stollenwerk
2009-06-18 20:57:47 +00:00
parent 476cc1c5e7
commit 34ee743bf3
8 changed files with 164 additions and 82 deletions
@@ -0,0 +1,56 @@
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__)