def setUp(self): import Products.GenericSetup.MailHost PlacelessSetup.setUp(self) BaseRegistryTests.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup.MailHost)
def testSetUp(cls): import Products.Five import zope.traversing zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', zope.traversing) setHooks()
def setup_uwoshsuccess(): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', Products.ATVocabularyManager) zcml.load_config('configure.zcml', Products.UWOshSuccess) fiveconfigure.debug_mode = False ztc.installProduct('ATVocabularyManager') ztc.installProduct('UWOshSuccess')
def test_bug_19_23_at_plone_org(self): """overrides.zcml should present in the root of the package""" import quintagroup.seoptimizer try: zcml.load_config('overrides.zcml', quintagroup.seoptimizer) except IOError: self.fail("overrides.zcml removed from the package root")
def setup_product(): fiveconfigure.debug_mode = True import collective.borgerdk zcml.load_config("configure.zcml", collective.borgerdk) fiveconfigure.debug_mode = False ztc.installPackage("collective.borgerdk")
def setUp(cls): fiveconfigure.debug_mode = True import collective.classification zcml.load_config('configure.zcml', collective.classification) fiveconfigure.debug_mode = False downloader.downloadNLTKPenTreeBank() downloader.downloadNLTKBrownCorpus()
def setup_zcml(): from Products.Five import zcml from Products.Five import fiveconfigure import plone.app.z3cform.tests fiveconfigure.debug_mode = True zcml.load_config('testing.zcml', plone.app.z3cform.tests) fiveconfigure.debug_mode = False
def setUp( cls ): from pas.plugins.sqlalchemy.model import Base testing.setUp() zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', pas.plugins.sqlalchemy) app = ZopeTestCase.app() # Create our sandbox app.manage_addFolder(SANDBOX_ID) sandbox = app[SANDBOX_ID] # Add a cache manager factory = sandbox.manage_addProduct['StandardCacheManagers'] factory.manage_addRAMCacheManager(CACHE_MANAGER_ID) # Setup the DB connection and PAS instances factory = EngineFactory('sqlite:///:memory:') engine = factory() Base.metadata.bind = engine Base.metadata.create_all(engine) cls.pas = cls.setupPAS(sandbox) utility = GloballyScopedSession( bind=engine, twophase=TEST_TWOPHASE) component.provideUtility(utility, provides=IScopedSession, name="pas.plugins.sqlalchemy") transaction.commit() ZopeTestCase.close(app)
def setUp(cls): ztc.installProduct('borg.project') ptc.setupPloneSite(products=( 'CMFPlacefulWorkflow', ), extension_profiles=( u'borg.project:default', )) fiveconfigure.debug_mode = True import borg.project zcml.load_config('configure.zcml', borg.project) import Products.CMFPlacefulWorkflow zcml.load_config('configure.zcml', Products.CMFPlacefulWorkflow) fiveconfigure.debug_mode = False # We need to tell the testing framework that these products # should be available. This can't happen until after we have loaded # the ZCML. Notice the extra package=True argument passed to # installProduct() - this tells it that these packages are *not* in the # Products namespace. ztc.installPackage('borg.localrole') ztc.installPackage('borg.project') SiteLayer.setUp()
def afterSetUp(self): super(TestImpact, self).afterSetUp() try: import ZenPacks.zenoss.DynamicView zcml.load_config('configure.zcml', ZenPacks.zenoss.DynamicView) except ImportError: pass try: import Products.Jobber zcml.load_config('meta.zcml', Products.Jobber) except ImportError: pass try: import ZenPacks.zenoss.Impact zcml.load_config('meta.zcml', ZenPacks.zenoss.Impact) zcml.load_config('configure.zcml', ZenPacks.zenoss.Impact) except ImportError: pass import ZenPacks.zenoss.Layer2 zcml.load_config('configure.zcml', ZenPacks.zenoss.Layer2) # Clear connections database. connections.clear()
def _load_test_config(): # Load up the ZCML config for the FiveTest product from os.path import dirname, join from Products.Five import zcml from Products.Five.tests.products import FiveTest prefix = dirname(FiveTest.__file__) zcml.load_config(join(prefix, 'testing.zcml'), FiveTest)
def setUp(cls): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', collective.collection.yearview) fiveconfigure.debug_mode = False ztc.installPackage('collective.collection.yearview')
def setUp(cls): fiveconfigure.debug_mode = True import eduintelligent.zipcontent zcml.load_config('configure.zcml', eduintelligent.zipcontent) ztc.installPackage('eduintelligent.zipcontent') fiveconfigure.debug_mode = False
def afterSetUp(self): fiveconfigure.debug_mode = True from plone.app import imaging zcml.load_config('testing.zcml', imaging) fiveconfigure.debug_mode = False installPackage('plone.app.imaging', quiet=True) self.addProfile('plone.app.imaging:default')
def setUp(self): import Products.CMFCore import Products.Five from Products.Five import zcml import Products.GenericSetup PlacelessSetup.setUp(self) RequestTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.DCWorkflow) factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite factory('site', 'CMFDefault:default', snapshot=False) self.site = self.root.site self.site._setObject( 'topic', Topic('topic') ) self.topic = self.site.topic self.topic.addCriterion('modified', 'Friendly Date Criterion') self.topic.addCriterion('portal_type', 'String Criterion') type_crit = self.topic.getCriterion('portal_type') type_crit.edit(value='Dummy Content') self.criterion = self.topic.getCriterion('modified') self.now = DateTime() self._old_as_of = _replace_DC__as_of(lambda: self.now) for i in self.day_diffs: dummy_id = 'dummy%i' % i self.site._setObject( dummy_id, DummyContent( id=dummy_id , catalog=1 ) ) dummy_ob = getattr(self.site, dummy_id) dummy_ob.modified_date = self.now + i dummy_ob.reindexObject()
def setup_product(): """Set up the package and its dependencies. The @onsetup decorator causes the execution of this body to be deferred until the setup of the Plone site testing layer. We could have created our own layer, but this is the easiest way for Plone integration tests. """ # Load the ZCML configuration for the example.tests package. # This can of course use <include /> to include other packages. fiveconfigure.debug_mode = True import Products.DssPageTypes zcml.load_config('configure.zcml', Products.DssPageTypes) fiveconfigure.debug_mode = False # We need to tell the testing framework that these products # should be available. This can't happen until after we have loaded # the ZCML. Thus, we do it here. Note the use of installPackage() # instead of installProduct(). # This is *only* necessary for packages outside the Products.* # namespace which are also declared as Zope 2 products, using # <five:registerPackage /> in ZCML. # We may also need to load dependencies, e.g.: # ztc.installPackage('borg.localrole') ztc.installPackage('Products.DssPageTypes')
def setUp(self): import Products.CMFCore.exportimport PlacelessSetup.setUp(self) BaseRegistryTests.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
def setUp(self): PlacelessSetup.setUp(self) RequestTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.GenericSetup) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.DCWorkflow) zcml.load_string(_TRAVERSE_ZCML) try: factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite factory('cmf', 'CMFDefault:default', snapshot=False) self.portal = self.root.cmf # Become a Manager self.uf = self.portal.acl_users self.uf.userFolderAddUser('manager', '', ['Manager'], []) self.login('manager') # Make a document self.discussion = self.portal.portal_discussion self.portal.invokeFactory('Document', id='doc') self.discussion.overrideDiscussionFor(self.portal.doc, 1) # Publish it self.workflow = self.portal.portal_workflow self.workflow.doActionFor(self.portal.doc, 'publish') except: self.tearDown() raise
def install_product(self): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', collective.autosaveform) ztc.installPackage(collective.autosaveform) self.addProfile('collective.autosaveform:default') self.addProduct('collective.autosaveform')
def setUp(cls): testing.setUp() zcml.load_config('meta.zcml', Products.Five) zcml.load_config('encrypt.zcml', Products.SQLPASPlugin) app = ZopeTestCase.app() # Create our sandbox app.manage_addFolder(SANDBOX_ID) sandbox = app[SANDBOX_ID] # Add a cache manager factory = sandbox.manage_addProduct['StandardCacheManagers'] factory.manage_addRAMCacheManager(CACHE_MANAGER_ID) # Setup the DB connection and PAS instances cls.conn = cls.setupConnection(sandbox) cls.pas = cls.setupPAS(sandbox) # Update PAS to use test tables users = cls.pas[USERMANAGER_ID] users.manage_changeProperties(users_table=TESTING_USERS_TABLE) roles = cls.pas[ROLEMANAGER_ID] roles.manage_changeProperties(roles_table=TESTING_ROLES_TABLE) props = cls.pas[PROPERTYPROVIDER_ID] props.manage_changeProperties(users_table=TESTING_USERS_TABLE) # Create the tables tests cls.execute(cls.createTable(TESTING_USERS_TABLE, TESTING_USERS_COLUMNS)) cls.execute(cls.createTable(TESTING_ROLES_TABLE, TESTING_ROLES_COLUMNS)) transaction.commit() ZopeTestCase.close(app)
def setUp(cls): fiveconfigure.debug_mode = True import quintagroup.pfg.captcha zcml.load_config('configure.zcml', quintagroup.pfg.captcha) fiveconfigure.debug_mode = False ztc.installPackage('quintagroup.pfg.captcha') ztc.installPackage('quintagroup.captcha.core')
def afterSetUp(self): # needed if this is run directly on the commandline, # since otherwise it will be __main__, and ZPL's afterSetup # will get confused. self.__module__ = 'ZenPacks.zenoss.OpenStackInfrastructure.tests.test_impact' super(TestImpact, self).afterSetUp() import Products.ZenEvents zcml.load_config('meta.zcml', Products.ZenEvents) # For Zenoss 4.1.1 zcml.load_string(''' <configure> <include package="zope.viewlet" file="meta.zcml" /> </configure>''') try: import ZenPacks.zenoss.DynamicView zcml.load_config('configure.zcml', ZenPacks.zenoss.DynamicView) except ImportError: return try: import ZenPacks.zenoss.Impact zcml.load_config('meta.zcml', ZenPacks.zenoss.Impact) zcml.load_config('configure.zcml', ZenPacks.zenoss.Impact) except ImportError: return import ZenPacks.zenoss.OpenStackInfrastructure zcml.load_config('configure.zcml', ZenPacks.zenoss.OpenStackInfrastructure)
def test_ct_views(self): zcml.load_config('testing.zcml', collective.carousel) # test tile for a Page obj = getattr(self.folder, 'carousel-doc') tile = queryMultiAdapter((obj, self.app.REQUEST), name="carousel-view") self.failUnless('PAGE' in tile(), obj) # test tile for a News Item obj = getattr(self.folder, 'carousel-news-item') tile = queryMultiAdapter((obj, self.app.REQUEST), name="carousel-view") self.failUnless('NEWS ITEM' in tile(), obj) # test tile for an Event. # Since we don't have any special view registered for Event in # zcml we should get default view for an object of this content type obj = getattr(self.folder, 'carousel-event') tile = queryMultiAdapter((obj, self.app.REQUEST), name="carousel-view") self.failUnless('DEFAULT' in tile(), obj) # test tile for a Page in a carousel portlet # since we don't have any special view for Page in the carousel portlet # we should get default tile for the carousel portlet that is the same # as for a carousel in the viewlet obj = getattr(self.folder, 'carousel-doc') tile = queryMultiAdapter((obj, self.app.REQUEST), name="carousel-portlet-view") self.failUnless('<p>This is a DEFAULT tile</p>' in tile(), obj)
def setup_product(): fiveconfigure.debug_mode = True import quintagroup.captcha.core import quintagroup.formlib.captcha zcml.load_config('configure.zcml', quintagroup.formlib.captcha) fiveconfigure.debug_mode = False ztc.installPackage('quintagroup.captcha.core')
def afterSetUp(self): super(TestObjects, self).afterSetUp() map(self.dmd.Devices.createOrganizer, (DEVICECLASS_DEPENDENCIES)) map(self.dmd.Events.createOrganizer, (EVENTCLASS_DEPENDENCIES)) map(self.dmd.Reports.createOrganizer, (REPORTCLASS_DEPENDENCIES)) self.dmd.REQUEST = None from Products.ZenRelations.ImportRM import NoLoginImportRM im = NoLoginImportRM(self.app) for zenpack in ZENPACK_DEPENDENCIES: __import__(zenpack) zp_module = sys.modules[zenpack] objects_file = '%s/objects/objects.xml' % zp_module.__path__[0] if os.path.isfile(objects_file): log.info('Loading objects for %s.', zenpack) im.loadObjectFromXML(objects_file) # Required to prevent erroring out when trying to define viewlets in # ../browser/configure.zcml. import zope.viewlet zcml.load_config('meta.zcml', zope.viewlet) import ZenPacks.zenoss.CloudStack zcml.load_config('configure.zcml', ZenPacks.zenoss.CloudStack)
def setup_navigationmanager(): """ Setup Products.NavigationManager """ fiveconfigure.debug_mode = True from Products import NavigationManager zcml.load_config('configure.zcml', NavigationManager) fiveconfigure.debug_mode = False
def afterSetUp(self): import collective.mediaelementjs zcml.load_config('configure.zcml', collective.mediaelementjs) self.addProfile('collective.mediaelementjs:default') # put resource registry to debug mode to avoid cachekyes in tests self.portal.portal_css.setDebugMode(True) self.portal.portal_javascripts.setDebugMode(True)
def afterSetUp(self): super(TestUpdateCatalog, self).afterSetUp() self.dmd.Devices.createOrganizer('/Network/Router/Cisco') class TestableZenMapper(ZenMapper): def __init__(self): ''' It breaks tests somewhere in parent class ''' self.zenmapper = TestableZenMapper() self.zenmapper.dmd = self.dmd self.zenmapper._workers = {} self.zenmapper.options = lambda: 1 self.zenmapper.options.device = False self.zenmapper.options.clear = False self.zenmapper.options.cycle = False self.zenmapper.options.redis_url = '' self.zenmapper.options.workers = 0 self.zenmapper.options.worker = False self.zenmapper.options.force = False self.zenmapper.options.optimize_interval = 0 import logging self.zenmapper.log = logging.getLogger("test") zcml.load_config('testing-noevent.zcml', Products.ZenTestCase) zcml.load_config('configure.zcml', ZenPacks.zenoss.Layer2) connections.clear()
def setup_product(): fiveconfigure.debug_mode = True import quintagroup.transmogrify.pfm2pfg zcml.load_config('configure.zcml', quintagroup.transmogrify.pfm2pfg) import quintagroup.transmogrify.pfm2pfg.tests zcml.load_config('test_import.zcml', quintagroup.transmogrify.pfm2pfg.tests) fiveconfigure.debug_mode = False
def setup_product(): """Set up the package and its dependencies. The @onsetup decorator causes the execution of this body to be deferred until the setup of the Plone site testing layer. We could have created our own layer, but this is the easiest way for Plone integration tests. """ ztc.installProduct('Archetypes') ztc.installProduct('MimetypesRegistry') ztc.installProduct('PortalTransforms') # to support tests for translated vocabularies ztc.installProduct('PloneLanguageTool') # Load the ZCML configuration for the example.tests package. # This can of course use <include /> to include other packages. import Products.ATVocabularyManager import plumi.content fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', Products.ATVocabularyManager) zcml.load_config('configure.zcml', plumi.content) fiveconfigure.debug_mode = False ztc.installPackage('ATVocabularyManager') ztc.installPackage('plumi.content')
def setUp(cls): zcml.load_config('configure.zcml', wigo.crmtool)
def setUp(cls): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', Products.RhaptosCollaborationTool) ztc.installPackage('Products.RhaptosCollaborationTool') fiveconfigure.debug_mode = False
def setUp(cls): zcml.load_config('configure.zcml', kk.sitecontent)
def setup_product(): fiveconfigure.debug_mode = True import quintagroup.captcha.core zcml.load_config('configure.zcml', quintagroup.captcha.core) fiveconfigure.debug_mode = False ztc.installPackage('quintagroup.captcha.core')
def setup_valentine_linguaflow(): """ Setup """ fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', valentine.linguaflow) zcml.load_config('testing.zcml', valentine.linguaflow.tests) fiveconfigure.debug_mode = False
def setUp(cls): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', Products.UniFile) ztc.installPackage('Products.UniFile') fiveconfigure.debug_mode = False
def setUp(cls): zcml.load_config('configure.zcml', enidlinder.app)
def testSetUp(cls): import Products.Five zcml.load_config('meta.zcml', Products.Five) zcml.load_config('traversing.zcml', Products.Five) setHooks()
def setUp(cls): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', covantec.cover.layouts) fiveconfigure.debug_mode = False
def setUp(self): zcml.load_config('meta.zcml', Products.GenericSetup)
def setUp(): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', collective.dancing) fiveconfigure.debug_mode = False ztc.installPackage('collective.dancing')
def setUp(cls): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', uwosh.simpleemergency) fiveconfigure.debug_mode = False
def setUp(self): BaseRegistryTests.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.CMFCore)
def setUp(self): import Products.DCWorkflow setUpEvents() setUpTraversing() setUpGenericSetup() zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.Five.browser) zcml.load_config('configure.zcml', Products.Five.skin) zcml.load_config('configure.zcml', Products.CMFCalendar) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_config('configure.zcml', Products.CMFDefault) zcml.load_config('configure.zcml', Products.DCWorkflow) self._oldSkindata = Skinnable.SKINDATA.copy() transaction.begin() app = self.app = ZopeTestCase.utils.makerequest(ZopeTestCase.app()) # Log in as a god :-) newSecurityManager( None, UnrestrictedUser('god', 'god', ['Manager'], '') ) factory = app.manage_addProduct['CMFDefault'].addConfiguredSite factory('CalendarTest', 'Products.CMFDefault:default', snapshot=False, extension_ids=('Products.CMFCalendar:default',)) self.Site = app.CalendarTest self.Tool = app.CalendarTest.portal_calendar # sessioning setup app.REQUEST.set_lazy( 'SESSION', app.session_data_manager.getSessionData )
def setUp(cls): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', thet.grak.layout) fiveconfigure.debug_mode = False
def setUp(cls): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', collective.portlet.itemview) fiveconfigure.debug_mode = False
def setUp(cls): import Products zcml.load_config('testing.zcml', Products.CMFCore) setHooks()
def afterSetUp(self): from Products.Five import zcml import five.pt zcml.load_config("configure.zcml", five.pt)
def setup_registration(): fiveconfigure.debug_mode = True import Products.EasyNewsletter zcml.load_config('configure.zcml', Products.EasyNewsletter) fiveconfigure.debug_mode = False
def setUp(cls): zcml.load_config('configure.zcml', mingtak.loginmethod)
def setUp(cls): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', collective.referencedatagridfield) ztc.installPackage('collective.referencedatagridfield') fiveconfigure.debug_mode = False
def setUp(cls): zope.component.testing.setUp(cls) zope.component.provideAdapter(DefaultTraversable, (None, )) import Products.ZenTestCase zcml.load_config('testing-noevent.zcml', Products.ZenTestCase) import Products.ZenTestCase zcml.load_config('testing-noevent.zcml', Products.ZenTestCase) import ZenPacks.zenoss.OpenStackInfrastructure zcml.load_config('configure.zcml', ZenPacks.zenoss.OpenStackInfrastructure) # Silly trickery here. # We create a single TestCase, and share the environment that it creates # across all our ModelTestCases (which we have inheriting from unittest.TestCase # instead) class DummyTestCase(zenpacklib.TestCase): disableLogging = False maxDiff = None zenpack_module_name = 'ZenPacks.zenoss.OpenStackInfrastructure' def test_donothing(self): pass cls.tc = DummyTestCase("test_donothing") cls.tc.setUp() cls.tc.afterSetUp() cls.tc.dmd.REQUEST = None # Workaround for IMP-389: # When Impact 5.2.1-5.2.3 (at least) are installed, setProdState # is patched to re-index the object in the global catalog specifically # on the productionState column, but at least on older verions of RM, # the sandboxed version of global_catalog does not index that column, # which causes setProdState to fail. Add the index for now, to # work around this. if (hasattr(cls.tc.dmd.global_catalog, 'indexes') and 'productionState' not in cls.tc.dmd.global_catalog.indexes()): from Products.ZenUtils.Search import makeCaseSensitiveFieldIndex cls.tc.dmd.global_catalog.addIndex( 'productionState', makeCaseSensitiveFieldIndex('productionState')) cls.tc.dmd.global_catalog.addColumn('productionState') dc = cls.tc.dmd.Devices.createOrganizer( '/Devices/OpenStack/Infrastructure') dc.setZenProperty('zPythonClass', 'ZenPacks.zenoss.OpenStackInfrastructure.Endpoint') dc.setZenProperty('zOpenStackHostDeviceClass', '/Server/SSH/Linux/NovaHost') dc.setZenProperty('zOpenStackRegionName', 'RegionOne') dc.setZenProperty('zOpenStackAuthUrl', 'http://1.2.3.4:5000/v2.0') dc.setZenProperty('zOpenStackNovaApiHosts', []) dc.setZenProperty('zOpenStackExtraHosts', []) dc.setZenProperty('zOpenStackHostMapToId', []) dc.setZenProperty('zOpenStackHostMapSame', []) dc.setZenProperty('zOpenStackHostLocalDomain', '') dc.setZenProperty('zOpenStackExtraApiEndpoints', []) # Create catalog try: from Products.ZenTestCase.BaseTestCase import init_model_catalog_for_tests init_model_catalog_for_tests() except ImportError: pass
def setUp(cls): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', collective.blog.portlets) fiveconfigure.debug_mode = False
def setUp(cls): zcml.load_config('configure.zcml', enslyon.opdsshowroom)
def setUp(self): BaseRegistryTests.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
def setup_product(): fiveconfigure.debug_mode = True import collective.dancefloor zcml.load_config('configure.zcml', collective.dancefloor) fiveconfigure.debug_mode = False ztc.installPackage('collective.dancefloor')
def setUp(self): from Products.CMFCore import CachingPolicyManager PlacelessSetup.setUp(self) RequestTest.setUp(self) FSDVTest.setUp(self) zcml.load_config('meta.zcml', Products.Five) zcml.load_config('permissions.zcml', Products.Five) zcml.load_config('configure.zcml', Products.CMFCore) zcml.load_string(_TRAVERSE_ZCML) now = DateTime() # Create a fake portal and the tools we need self.portal = DummySite(id='portal').__of__(self.root) self.portal._setObject('portal_types', DummyTool()) # This is a FSPageTemplate that will be used as the View for # our content objects. It doesn't matter what it returns. path = os.path.join(self.skin_path_name, 'testPT2.pt') self.portal._setObject('dummy_view', FSPageTemplate('dummy_view', path)) uf = self.root.acl_users password = '******' uf.userFolderAddUser(portal_owner, password, ['Manager'], []) user = uf.getUserById(portal_owner) if not hasattr(user, 'aq_base'): user = user.__of__(uf) newSecurityManager(None, user) owner_auth = '%s:%s' % (portal_owner, password) self.auth_header = "Basic %s" % base64.encodestring(owner_auth) self.portal._setObject('doc1', DummyContent('doc1')) self.portal._setObject('doc2', DummyContent('doc2')) self.portal._setObject('doc3', DummyContent('doc3')) self.portal.doc1.modified_date = now self.portal.doc2.modified_date = now self.portal.doc3.modified_date = now CachingPolicyManager.manage_addCachingPolicyManager(self.portal) cpm = self.portal.caching_policy_manager # This policy only applies to doc1. It will not emit any ETag header # but it enables If-modified-since handling. cpm.addPolicy(policy_id='policy_no_etag', predicate='python:object.getId()=="doc1"', mtime_func='', max_age_secs=0, no_cache=0, no_store=0, must_revalidate=0, vary='', etag_func='', enable_304s=1) # This policy only applies to doc2. It will emit an ETag with # the constant value "abc" and also enable if-modified-since handling. cpm.addPolicy(policy_id='policy_etag', predicate='python:object.getId()=="doc2"', mtime_func='', max_age_secs=0, no_cache=0, no_store=0, must_revalidate=0, vary='', etag_func='string:abc', enable_304s=1) # This policy only applies to doc3. Etags with constant values of # "abc" are emitted, but if-modified-since handling is turned off. cpm.addPolicy(policy_id='policy_disabled', predicate='python:object.getId()=="doc3"', mtime_func='', max_age_secs=0, no_cache=0, no_store=0, must_revalidate=0, vary='', etag_func='string:abc', enable_304s=0)
def setUp(cls): import Products zcml.load_config('meta.zcml', Products.Five) zcml.load_config('event.zcml', Products.Five) zcml.load_config('event.zcml', Products.CMFCore)
def afterSetUp(self): super(TestCase, self).afterSetUp() # Not included with BaseTestCase. Needed to test that UI # components have been properly registered. from Products.Five import zcml import Products.ZenUI3 zcml.load_config('configure.zcml', Products.ZenUI3) if not hasattr( self, 'zenpack_module_name') or self.zenpack_module_name is None: self.zenpack_module_name = '.'.join( self.__module__.split('.')[:-2]) try: import importlib zenpack_module = importlib.import_module( self.zenpack_module_name) except Exception: LOG.exception( "Unable to load zenpack named '%s' - is it installed? (%s)", self.zenpack_module_name) raise zenpackspec = getattr(zenpack_module, 'CFG', None) if not zenpackspec: raise NameError("name {!r} is not defined".format('.'.join( (self.zenpack_module_name, 'CFG')))) zenpackspec.test_setup() import Products.ZenEvents zcml.load_config('meta.zcml', Products.ZenEvents) try: import ZenPacks.zenoss.DynamicView zcml.load_config('configure.zcml', ZenPacks.zenoss.DynamicView) except ImportError: pass try: import Products.Jobber zcml.load_config('meta.zcml', Products.Jobber) except ImportError: pass try: import ZenPacks.zenoss.Impact zcml.load_config('meta.zcml', ZenPacks.zenoss.Impact) zcml.load_config('configure.zcml', ZenPacks.zenoss.Impact) except ImportError: pass try: zcml.load_config('configure.zcml', zenpack_module) except IOError: pass # BaseTestCast.afterSetUp already hides transaction.commit. So we also # need to hide transaction.abort. self._transaction_abort = Transaction.abort Transaction.abort = lambda *x: None
def setUp(cls): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', easyshop.information) fiveconfigure.debug_mode = False