diff --git a/plone/formwidget/contenttree/configure.zcml b/plone/formwidget/contenttree/configure.zcml index d10918c..66bd52f 100644 --- a/plone/formwidget/contenttree/configure.zcml +++ b/plone/formwidget/contenttree/configure.zcml @@ -33,7 +33,4 @@ provides="Products.GenericSetup.interfaces.EXTENSION" /> - - - diff --git a/plone/formwidget/contenttree/testing.py b/plone/formwidget/contenttree/testing.py new file mode 100644 index 0000000..d3167fd --- /dev/null +++ b/plone/formwidget/contenttree/testing.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +from plone.app.testing import PLONE_FIXTURE +from plone.app.testing import TEST_USER_ID +from plone.app.testing import PloneSandboxLayer +from plone.app.testing import helpers +from plone.app.testing import layers +from plone.app.testing import login +from plone.app.testing import setRoles +from plone.testing import z2 +from zope.configuration import xmlconfig + +import doctest + + +class ContentTreeLayer(PloneSandboxLayer): + + defaultBases = (PLONE_FIXTURE, ) + + def setUpZope(self, app, configurationContext): + import plone.formwidget.contenttree + xmlconfig.file('testing.zcml', + plone.formwidget.contenttree, + context=configurationContext) + + def setUpPloneSite(self, portal): + helpers.applyProfile(portal, 'plone.formwidget.contenttree:default') + + portal.acl_users.userFolderAddUser('admin', 'secret', ['Manager'], []) + + login(portal, 'admin') + portal.portal_workflow.setDefaultChain("simple_publication_workflow") + + setRoles(portal, TEST_USER_ID, ['Manager']) + portal.invokeFactory("Folder", + id="contenttree-test-folder", + title=u"A Test Folder") + + +CONTENTTREE_FIXTURE = ContentTreeLayer() +CONTENTTREE_INTEGRATION_TESTING = layers.IntegrationTesting( + bases=(CONTENTTREE_FIXTURE,), + name="plone.formwidget.contenttree:Integration") +CONTENTTREE_FUNCTIONAL_TESTING = layers.FunctionalTesting( + bases=(CONTENTTREE_FIXTURE, z2.ZSERVER_FIXTURE), + name="plone.formwidget.contenttree:Functional") + +optionflags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE) diff --git a/plone/formwidget/contenttree/testing.zcml b/plone/formwidget/contenttree/testing.zcml index cbbf491..4c088ae 100644 --- a/plone/formwidget/contenttree/testing.zcml +++ b/plone/formwidget/contenttree/testing.zcml @@ -9,4 +9,6 @@ + + diff --git a/plone/formwidget/contenttree/tests.py b/plone/formwidget/contenttree/tests.py deleted file mode 100644 index a83ad4c..0000000 --- a/plone/formwidget/contenttree/tests.py +++ /dev/null @@ -1,19 +0,0 @@ -import os -import unittest - -from zope.testing import doctest -from zope.app.testing.functional import ZCMLLayer - -testing_zcml_path = os.path.join(os.path.dirname(__file__), 'testing.zcml') -testing_zcml_layer = ZCMLLayer(testing_zcml_path, - 'plone.formwidget.contenttree', - 'testing_zcml_layer') - - -def test_suite(): - readme_txt = doctest.DocFileSuite('README.txt') - readme_txt.layer = testing_zcml_layer - - return unittest.TestSuite([ - readme_txt, - ]) diff --git a/plone/formwidget/contenttree/tests/__init__.py b/plone/formwidget/contenttree/tests/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/plone/formwidget/contenttree/tests/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/plone/formwidget/contenttree/tests/test_doctests.py b/plone/formwidget/contenttree/tests/test_doctests.py new file mode 100644 index 0000000..05e11a2 --- /dev/null +++ b/plone/formwidget/contenttree/tests/test_doctests.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from plone.formwidget.contenttree.testing import ( + CONTENTTREE_INTEGRATION_TESTING, +) +from plone.testing import layered + +import doctest +import unittest + + +def test_suite(): + suite = unittest.TestSuite() + suite.addTests([ + layered(doctest.DocFileSuite('../README.txt'), + CONTENTTREE_INTEGRATION_TESTING) + ]) + + return suite diff --git a/setup.py b/setup.py index 9960070..c16349d 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ setup(name='plone.formwidget.contenttree', ], extras_require={ 'test': [ - 'zope.app.testing', + 'plone.app.testing', ], }, entry_points=""" diff --git a/test-plone-4.3.x.cfg b/test-plone-4.3.x.cfg index 1fc18fc..fd1da0a 100644 --- a/test-plone-4.3.x.cfg +++ b/test-plone-4.3.x.cfg @@ -14,6 +14,11 @@ parts += zopepy +[instance] +zcml-additional = + + + [test] recipe = zc.recipe.testrunner defaults = ['-s', '${buildout:package-name}', '--auto-color', '--auto-progress']