From a6fb8dd8de989eec95d7bb7f1b18f70b970a5a11 Mon Sep 17 00:00:00 2001 From: Lennart Regebro Date: Sat, 16 May 2009 09:47:10 +0000 Subject: [PATCH] Added a test setup. svn path=/plone.app.discussion/trunk/; revision=26958 --- plone/app/discussion/configure.zcml | 18 ++++++++++++-- plone/app/discussion/conversation.py | 2 +- plone/app/discussion/tests/base.py | 29 ++++++++++++++++++++++ plone/app/discussion/tests/test_api.py | 34 ++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 plone/app/discussion/tests/base.py create mode 100644 plone/app/discussion/tests/test_api.py diff --git a/plone/app/discussion/configure.zcml b/plone/app/discussion/configure.zcml index 97c29a6..921eba2 100644 --- a/plone/app/discussion/configure.zcml +++ b/plone/app/discussion/configure.zcml @@ -1,15 +1,29 @@ - + + + + - + diff --git a/plone/app/discussion/conversation.py b/plone/app/discussion/conversation.py index 101049d..7e4a0a7 100644 --- a/plone/app/discussion/conversation.py +++ b/plone/app/discussion/conversation.py @@ -10,7 +10,7 @@ manipulating the comments directly in reply to a particular comment or at the top level of the conversation. """ -from persistence import Persistent +from persistent import Persistent from zope.interface import implements, implementer from zope.component import adapts, adapter diff --git a/plone/app/discussion/tests/base.py b/plone/app/discussion/tests/base.py new file mode 100644 index 0000000..98a2c0c --- /dev/null +++ b/plone/app/discussion/tests/base.py @@ -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 + diff --git a/plone/app/discussion/tests/test_api.py b/plone/app/discussion/tests/test_api.py new file mode 100644 index 0000000..300354e --- /dev/null +++ b/plone/app/discussion/tests/test_api.py @@ -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')