Added a test setup.

svn path=/plone.app.discussion/trunk/; revision=26958
This commit is contained in:
Lennart Regebro 2009-05-16 09:47:10 +00:00
parent f23baf0f51
commit a6fb8dd8de
4 changed files with 80 additions and 3 deletions

View File

@ -1,15 +1,29 @@
<configure xmlns="http://namespaces.zope.org/zope" i18n_domain="plone.app.discussion"> <configure
xmlns="http://namespaces.zope.org/zope"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
i18n_domain="plone.app.discussion">
<include file="permissions.zcml" /> <include file="permissions.zcml" />
<include package=".browser" /> <include package=".browser" />
<!-- Register the installation GenericSetup extension profile -->
<genericsetup:registerProfile
name="default"
title="Plone Discussions"
directory="profiles/default"
description="Setup plone.app.discussions."
provides="Products.GenericSetup.interfaces.EXTENSION"
/>
<!-- Comments --> <!-- Comments -->
<class class=".comment.Comment"> <class class=".comment.Comment">
<require interface=".interfaces.IComment" permission="zope2.View" /> <require interface=".interfaces.IComment" permission="zope2.View" />
<require attributes="Title Creator getId" permission="zope2.View" /> <require attributes="Title Creator getId" permission="zope2.View" />
</class> </class>
<utility object=".comment.CommentFactory" name="Discussion Item" /> <utility factory=".comment.CommentFactory"
provides="plone.app.discussion.interfaces.IComment"
name="Discussion Item" />
<!-- Conversations --> <!-- Conversations -->
<class class=".conversation.Conversation"> <class class=".conversation.Conversation">

View File

@ -10,7 +10,7 @@ manipulating the comments directly in reply to a particular comment or at the
top level of the conversation. top level of the conversation.
""" """
from persistence import Persistent from persistent import Persistent
from zope.interface import implements, implementer from zope.interface import implements, implementer
from zope.component import adapts, adapter from zope.component import adapts, adapter

View File

@ -0,0 +1,29 @@
import unittest
from zope.testing import doctestunit
from zope.component import testing, getMultiAdapter
from zope.publisher.browser import TestRequest
from zope.publisher.interfaces.browser import IBrowserView
from Testing import ZopeTestCase as ztc
from Products.Five import zcml
from Products.Five import fiveconfigure
from Products.PloneTestCase import PloneTestCase as ptc
from Products.PloneTestCase.layer import PloneSite
ptc.setupPloneSite(extension_profiles=['plone.app.discussion:default'])
import plone.app.discussion
class TestCase(ptc.PloneTestCase):
class layer(PloneSite):
@classmethod
def setUp(cls):
fiveconfigure.debug_mode = True
zcml.load_config('configure.zcml',
plone.app.discussion)
fiveconfigure.debug_mode = False
@classmethod
def tearDown(cls):
pass

View File

@ -0,0 +1,34 @@
import unittest
from base import TestCase
from zope.testing import doctestunit
from zope.component import testing, getMultiAdapter
from zope.publisher.browser import TestRequest
from zope.publisher.interfaces.browser import IBrowserView
from Testing import ZopeTestCase as ztc
from Products.Five import zcml
from Products.Five import fiveconfigure
from Products.PloneTestCase import PloneTestCase as ptc
from Products.PloneTestCase.layer import PloneSite
class APITest(TestCase):
def afterSetUp(self):
# XXX If we make this a layer, it only get run once...
# First we need to create some content.
self.loginAsPortalOwner()
typetool = self.portal.portal_types
typetool.constructContent('Document', self.portal, 'doc1')
def test_test(self):
raise NotImplementedError
def test_suite():
return unittest.TestSuite([
unittest.makeSuite(APITest),
])
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')