pass class PloneTiles(Layer): defaultBases = (z2.STARTUP, ) def setUp(self): import plone.tiles self['configurationContext'] = context = zca.stackConfigurationContext( self.get('configurationContext')) xmlconfig.file('configure.zcml', plone.tiles, context=context) def tearDown(self): del self['configurationContext'] PLONE_TILES_FIXTURE = PloneTiles() PLONE_TILES_INTEGRATION_TESTING = z2.IntegrationTesting( bases=(PLONE_TILES_FIXTURE, ), name='PloneTiles:Functional') def test_suite(): return unittest.TestSuite( (layered(doctest.DocFileSuite('tiles.rst', 'directives.rst', 'data.rst', 'esi.rst', optionflags=doctest.ELLIPSIS), layer=PLONE_TILES_INTEGRATION_TESTING), ))
# -*- coding: utf-8 -*- from plone.app.testing import FunctionalTesting from plone.testing import z2 from plone.testing import zca from Products.MeetingCommunes.testing import MCLayer import Products.MeetingBEP MBEP_ZCML = zca.ZCMLSandbox(filename="testing.zcml", package=Products.MeetingBEP, name='MBEP_ZCML') MBEP_Z2 = z2.IntegrationTesting(bases=(z2.STARTUP, MBEP_ZCML), name='MBEP_Z2') MBEP_TESTING_PROFILE = MCLayer( zcml_filename="testing.zcml", zcml_package=Products.MeetingBEP, additional_z2_products=('imio.dashboard', 'Products.MeetingBEP', 'Products.MeetingCommunes', 'Products.PloneMeeting', 'Products.CMFPlacefulWorkflow', 'Products.PasswordStrength'), gs_profile_id='Products.MeetingBEP:testing', name="MBEP_TESTING_PROFILE") MBEP_TESTING_PROFILE_FUNCTIONAL = FunctionalTesting( bases=(MBEP_TESTING_PROFILE,), name="MBEP_TESTING_PROFILE_FUNCTIONAL")
from plone.app.testing import FunctionalTesting from plone.testing import z2 from plone.testing import zca from Products.MeetingCommunes.testing import MCLayer import Products.MeetingLalouviere class LLLayer(MCLayer): """ """ MLL_ZCML = zca.ZCMLSandbox(filename="testing.zcml", package=Products.MeetingLalouviere, name="MLL_ZCML") MLL_Z2 = z2.IntegrationTesting(bases=(z2.STARTUP, MLL_ZCML), name="MLL_Z2") MLL_TESTING_PROFILE = LLLayer( zcml_filename="testing.zcml", zcml_package=Products.MeetingLalouviere, additional_z2_products=( "imio.dashboard", "Products.MeetingLalouviere", # "Products.MeetingCommunes", "Products.PloneMeeting", "Products.CMFPlacefulWorkflow", "Products.PasswordStrength", ), gs_profile_id="Products.MeetingLalouviere:testing", name="MLL_TESTING_PROFILE", )
taskqueue.reset() class LocalTaskQueueServerLayer(TaskQueueServerLayer): def setUp(self): queue = taskqueue.LocalVolatileTaskQueue() sm = getSiteManager() sm.registerUtility(queue, provided=ITaskQueue, name='test-queue') super(LocalTaskQueueServerLayer, self).setUp() TASK_QUEUE_FIXTURE = LocalTaskQueueServerLayer(queue='test-queue') TASK_QUEUE_ZSERVER_FIXTURE =\ LocalTaskQueueServerLayer(queue='test-queue', zserver_enabled=True) TASK_QUEUE_INTEGRATION_TESTING = z2.IntegrationTesting( bases=(TASK_QUEUE_FIXTURE, ), name='TaskQueue:Integration') TASK_QUEUE_FUNCTIONAL_TESTING = z2.FunctionalTesting( bases=(TASK_QUEUE_FIXTURE, ), name='TaskQueue:Functional') class RedisTaskQueueServerLayer(TaskQueueServerLayer): def setUp(self): queue = redisqueue.RedisTaskQueue() sm = getSiteManager() sm.registerUtility(queue, provided=ITaskQueue, name='test-queue') super(RedisTaskQueueServerLayer, self).setUp() REDIS_TASK_QUEUE_FIXTURE = RedisTaskQueueServerLayer(queue='test-queue') REDIS_TASK_QUEUE_ZSERVER_FIXTURE =\
setLocal('request', portal.REQUEST) # configure default workflows so Folder has a workflow # make sure we have a default workflow portal.portal_workflow.setDefaultChain('simple_publication_workflow') super(PMLayer, self).setUpPloneSite(portal) # Create member area of existing users for user in api.user.get_users(): # this layer is used by imio.pm.wsclient _createMemberarea(portal, user.getId()) PM_ZCML = zca.ZCMLSandbox(filename="testing.zcml", package=Products.PloneMeeting, name='PM_ZCML') PM_Z2 = z2.IntegrationTesting(bases=(z2.STARTUP, PM_ZCML), name='PM_Z2') PM_TESTING_PROFILE = PMLayer( zcml_filename="testing.zcml", zcml_package=Products.PloneMeeting, additional_z2_products=('Products.PloneMeeting', 'collective.eeafaceted.collectionwidget', 'Products.CMFPlacefulWorkflow', 'Products.PasswordStrength'), gs_profile_id='Products.PloneMeeting:testing', name="PM_TESTING_PROFILE") PM_TESTING_PROFILE_INTEGRATION = IntegrationTesting( bases=(PM_TESTING_PROFILE, ), name="PM_TESTING_PROFILE_INTEGRATION") PM_TESTING_PROFILE_FUNCTIONAL = FunctionalTesting(
# -*- coding: utf-8 -*- from plone.app.testing import FunctionalTesting from plone.app.testing import PloneWithPackageLayer from plone.testing import z2 from plone.testing import zca import imio.migrator MIGRATOR_ZCML = zca.ZCMLSandbox(filename="testing.zcml", package=imio.migrator, name='MIGRATOR_ZCML') MIGRATOR_Z2 = z2.IntegrationTesting(bases=(z2.STARTUP, MIGRATOR_ZCML), name='MIGRATOR_Z2') MIGRATOR_TESTING_PROFILE = PloneWithPackageLayer( zcml_filename="testing.zcml", zcml_package=imio.migrator, additional_z2_products=(), name="MIGRATOR_TESTING_PROFILE") MIGRATOR_TESTING_PROFILE_FUNCTIONAL = FunctionalTesting( bases=(MIGRATOR_TESTING_PROFILE, ), name="MIGRATOR_TESTING_PROFILE_FUNCTIONAL")
zope_conf = getConfiguration() # Put the ZServer we launched into the configured servers list zope_conf.servers = [self.zserver] # The STARTUP fixture has already been run, and Products.ZServerViews # didn't find a ZServer to initialize, so rerun its initialization now: import Products.ZServerViews Products.ZServerViews.initialize(None) def tearDownServer(self): getConfiguration().servers.remove(self.zserver) super(ZServer, self).tearDownServer() ZSERVER_FIXTURE = ZServer() MUNIN_ZOPE_INTEGRATION_TESTING = z2.IntegrationTesting( bases=(MUNIN_ZOPE_FIXTURE, ), name='MuninZope:Integration') MUNIN_ZOPE_ZSERVER = z2.FunctionalTesting(bases=(ZSERVER_FIXTURE, ), name='MuninZope:ZServer') class HolderView(BrowserView): _lock = Lock() green_light = Event() # view is non-blocked at first green_light.set() def __call__(self): with self._lock: self.green_light.wait()
self['rabbitctl']('start_app') def tearDown(self): try: self['rabbit'].cleanUp() except OSError as e: if e.errno == 3: # [Errno 3] No such process # Rabbit may have already died because of KeyboardInterrupt pass else: raise RABBIT_FIXTURE = Rabbit() RABBIT_APP_INTEGRATION_TESTING = z2.IntegrationTesting( bases=(RABBIT_FIXTURE, z2.STARTUP), name='RabbitAppFixture:Integration') RABBIT_APP_FUNCTIONAL_TESTING = z2.FunctionalTesting( bases=(RABBIT_FIXTURE, z2.STARTUP), name='RabbitAppFixture:Functional') class Testing(Layer): defaultBases = (RABBIT_FIXTURE, z2.STARTUP) def setUp(self): import collective.zamqp xmlconfig.file('testing.zcml', collective.zamqp, context=self['configurationContext']) TESTING_FIXTURE = Testing()
from plone.testing import z2 from plone.testing import zca from Products.PloneMeeting.testing import PMLayer import imio.pm.ws class WSCLIENTLayer(PMLayer): """ """ WS4PMCLIENT_ZCML = zca.ZCMLSandbox(filename="testing.zcml", package=imio.pm.wsclient, name='WS4PMCLIENT_ZCML') WS4PMCLIENT_Z2 = z2.IntegrationTesting(bases=(z2.STARTUP, WS4PMCLIENT_ZCML), name='WS4PMCLIENT_Z2') WS4PMCLIENT = WSCLIENTLayer( zcml_filename="testing-settings.zcml", zcml_package=imio.pm.wsclient, additional_z2_products=('imio.dashboard', 'imio.pm.wsclient', 'imio.pm.ws', 'Products.PasswordStrength'), gs_profile_id='imio.pm.wsclient:testing', name="WS4PMCLIENT") WS4PMCLIENT_PM_TESTING_PROFILE = WSCLIENTLayer( bases=(WS4PMCLIENT, ), zcml_filename="testing.zcml", zcml_package=imio.pm.wsclient,
from plone.testing import z2 from plone.testing import Layer class PTProfilerLayer(Layer): defaultBases = (z2.STARTUP, ) def setUp(self): with z2.zopeApp() as app: z2.installProduct(app, 'Products.PTProfiler') def tearDown(self): with z2.zopeApp() as app: z2.installProduct(app, 'Products.PTProfiler') PTPROFILER = PTProfilerLayer(name='PTPROFILER') PTPROFILER_INTEGRATION = z2.IntegrationTesting(bases=(PTPROFILER, ), name='PTPROFILER_INTEGRATION')
# -*- coding: utf-8 -*- from plone.testing import Layer from plone.testing import z2 from plone.testing import zca import plone.autoform AUTOFORM_FIXTURE = zca.ZCMLSandbox(bases=(z2.STARTUP, ), filename='configure.zcml', package=plone.autoform, name="plone.autoform:Fixture") AUTOFORM_INTEGRATION_TESTING = z2.IntegrationTesting( bases=(AUTOFORM_FIXTURE, ), name="plone.autoform:Integration")
site = self.get('site') local_components = site.getSiteManager() if global_components not in local_components.__bases__: local_components.__bases__ = (global_components,) def tearDown(self): # remove the stacked storage layer self['zodbDB'].close() del(self['zodbDB']) zca.popGlobalRegistry() CMF_SITE_LAYER = CMFSiteLayer() CMF_SITE_TESTING = z2.IntegrationTesting( bases=(CMF_SITE_LAYER,), name='CMF site integration testing', ) class RetrievalCMFAppLayer(Layer): """ Layer for testing integration of persistent components in a minimal CMF/Zope2 environment. Many of the tests using this fixture layer only need ZODB, ZCA, so this is just a host of most convenience to cover the handful/minority of Zope2 or CMF-specific needs (like an object resolver component using a Catalog and OFS interfaces). But this Zope2 usage is all loosely-coupled, so this Layer is not a normative suggestion of the only uses for these components. """
def setUp(self): # Stack a new configuration context self['configurationContext'] = context = zca.stackConfigurationContext( self.get('configurationContext')) import plone.resource xmlconfig.file('testing.zcml', plone.resource, context=context) def tearDown(self): # Zap the stacked configuration context del self['configurationContext'] DEMO_TRAVERSER_FIXTURE = DemoTraverser() DEMO_TRAVERSER_INTEGRATION_TESTING = \ z2.IntegrationTesting(bases=(DEMO_TRAVERSER_FIXTURE,), name="plone.resource:DemoTraverser") class PloneResource(PloneSandboxLayer): defaultBases = (PLONE_FIXTURE, ) def setUpZope(self, app, configurationContext): # Load ZCML import plone.resource xmlconfig.file('configure.zcml', plone.resource, context=configurationContext) def setUpPloneSite(self, portal): # install into the Plone site applyProfile(portal, 'plone.resource:default')
def setUp(self): zca.pushGlobalRegistry() import plone.namedfile xmlconfig.file('testing.zcml', plone.namedfile) self['zodbDB'] = zodb.stackDemoStorage(self.get('zodbDB'), name='NamedFileFixture') def tearDown(self): # Zap the stacked ZODB self['zodbDB'].close() del self['zodbDB'] # Zap the stacked zca context zca.popGlobalRegistry() PLONE_NAMEDFILE_FIXTURE = NamedFileTestLayer() PLONE_NAMEDFILE_INTEGRATION_TESTING = z2.IntegrationTesting( bases=(PLONE_NAMEDFILE_FIXTURE, ), name='plone.namedfile:NamedFileTestLayerIntegration', ) PLONE_NAMEDFILE_FUNCTIONAL_TESTING = z2.FunctionalTesting( bases=(PLONE_NAMEDFILE_FIXTURE, ), name='plone.namedfile:NamedFileTestLayerFunctional', )
# -*- coding: utf-8 -*- from plone.testing import z2, zca from plone.app.testing import PloneWithPackageLayer from plone.app.testing import FunctionalTesting import imio.actionspanel ACTIONSPANEL_ZCML = zca.ZCMLSandbox(filename="testing.zcml", package=imio.actionspanel, name='ACTIONSPANEL_ZCML') ACTIONSPANEL_Z2 = z2.IntegrationTesting(bases=(z2.STARTUP, ACTIONSPANEL_ZCML), name='ACTIONSPANEL_Z2') ACTIONSPANEL_TESTING_PROFILE = PloneWithPackageLayer( zcml_filename="testing.zcml", zcml_package=imio.actionspanel, additional_z2_products=(), name="ACTIONSPANEL_TESTING_PROFILE") ACTIONSPANEL_TESTING_PROFILE_FUNCTIONAL = FunctionalTesting( bases=(ACTIONSPANEL_TESTING_PROFILE, ), name="ACTIONSPANEL_TESTING_PROFILE_FUNCTIONAL")