import unittest from datetime import datetime from zope.component import createObject, queryUtility from OFS.Image import Image from plone.registry.interfaces import IRegistry from Products.CMFCore.utils import getToolByName from Products.CMFPlone.tests import dummy from Products.Five.testbrowser import Browser from Products.PloneTestCase.ptc import PloneTestCase from Products.PloneTestCase.ptc import FunctionalTestCase from plone.app.discussion.browser.comments import CommentsViewlet from plone.app.discussion.interfaces import IConversation from plone.app.discussion.tests.layer import DiscussionLayer class TestCommentForm(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.viewlet = CommentsViewlet(context, request, None, None) def test_add_comment(self): #form = CommentForm(self.viewlet, self.app.REQUEST) #self.viewlet.form.render(form) #self.viewlet.form.handleComment() #from z3c.form.testing import TestRequest #request = TestRequest(form={ # 'form.widgets.title': u'bar', # 'form.widgets.text': u'foo',} #) #cf = CommentForm(self.viewlet, request) #cf.handleComments() # Zope publisher uses Python list to mark