Use plone.app.testing in test_conversation.

svn path=/plone.app.discussion/trunk/; revision=48901
This commit is contained in:
Timo Stollenwerk 2011-04-16 09:27:15 +00:00
parent c4e69627b3
commit 41f5afa8b9

View File

@ -1,4 +1,4 @@
import unittest import unittest2 as unittest
from datetime import datetime, timedelta from datetime import datetime, timedelta
from zope import interface from zope import interface
@ -12,8 +12,10 @@ from plone.app.vocabularies.types import BAD_TYPES
from plone.registry.interfaces import IRegistry from plone.registry.interfaces import IRegistry
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.PloneTestCase.ptc import PloneTestCase
from plone.app.discussion.tests.layer import DiscussionLayer from plone.app.testing import TEST_USER_ID, setRoles
from plone.app.discussion.testing import PLONE_APP_DISCUSSION_INTEGRATION_TESTING
from plone.app.discussion import interfaces from plone.app.discussion import interfaces
from plone.app.discussion.interfaces import IConversation from plone.app.discussion.interfaces import IConversation
@ -22,16 +24,16 @@ from plone.app.discussion.interfaces import IReplies
from plone.app.discussion.interfaces import IDiscussionSettings from plone.app.discussion.interfaces import IDiscussionSettings
class ConversationTest(PloneTestCase): class ConversationTest(unittest.TestCase):
layer = DiscussionLayer layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
def afterSetUp(self): def setUp(self):
self.portal = self.layer['portal']
setRoles(self.portal, TEST_USER_ID, ['Manager'])
interface.alsoProvides( interface.alsoProvides(
self.portal.REQUEST, interfaces.IDiscussionLayer) self.portal.REQUEST, interfaces.IDiscussionLayer)
# First we need to create some content.
self.loginAsPortalOwner()
typetool = self.portal.portal_types typetool = self.portal.portal_types
typetool.constructContent('Document', self.portal, 'doc1') typetool.constructContent('Document', self.portal, 'doc1')
self.typetool = typetool self.typetool = typetool
@ -715,15 +717,15 @@ class ConversationTest(PloneTestCase):
IAnnotations(self.portal.doc1)) IAnnotations(self.portal.doc1))
class RepliesTest(PloneTestCase): class RepliesTest(unittest.TestCase):
# test the IReplies adapter on a conversation # test the IReplies adapter on a conversation
layer = DiscussionLayer layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
def afterSetUp(self): def setUp(self):
# First we need to create some content. self.portal = self.layer['portal']
self.loginAsPortalOwner() setRoles(self.portal, TEST_USER_ID, ['Manager'])
typetool = self.portal.portal_types typetool = self.portal.portal_types
typetool.constructContent('Document', self.portal, 'doc1') typetool.constructContent('Document', self.portal, 'doc1')