From 9f1459d591c14e95723a9ed8705f9770f9084d05 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Wed, 10 Jul 2013 10:31:13 +0200 Subject: [PATCH] Add plone.app.testing setup. For now we have to use PTC and p.a.testing at the same timeuntil we moved all tests to use p.a.testing. It does not make sense to write new tests for PTC. --- src/collective/solr/testing.py | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/collective/solr/testing.py diff --git a/src/collective/solr/testing.py b/src/collective/solr/testing.py new file mode 100644 index 0000000..e265df3 --- /dev/null +++ b/src/collective/solr/testing.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +from plone.app.testing import TEST_USER_ID +from plone.app.testing import TEST_USER_NAME +from plone.app.testing import login +from plone.app.testing import setRoles +from plone.app.testing import applyProfile +from plone.app.testing import PloneSandboxLayer +from plone.app.testing import PLONE_FIXTURE +from plone.app.testing import IntegrationTesting +from plone.app.testing import FunctionalTesting +from zope.configuration import xmlconfig + + +class CollectiveSolr(PloneSandboxLayer): + + defaultBases = (PLONE_FIXTURE,) + + def setUpZope(self, app, configurationContext): + # Load ZCML + import collective.solr + xmlconfig.file('configure.zcml', + collective.solr, + context=configurationContext) + + def setUpPloneSite(self, portal): + applyProfile(portal, 'collective.solr:default') + setRoles(portal, TEST_USER_ID, ['Manager']) + login(portal, TEST_USER_NAME) + + +COLLECTIVE_SOLR_FIXTURE = CollectiveSolr() +COLLECTIVE_SOLR_INTEGRATION_TESTING = IntegrationTesting( + bases=(COLLECTIVE_SOLR_FIXTURE,), + name="CollectiveSolr:Integration") +COLLECTIVE_SOLR_FUNCTIONAL_TESTING = FunctionalTesting( + bases=(COLLECTIVE_SOLR_FIXTURE,), + name="CollectiveSolr:Functional")