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(cls): metaconfigure.debug_mode = True import dexterity.membrane zcml.load_config('configure.zcml', dexterity.membrane) metaconfigure.debug_mode = False installPackage('collective.indexing') installPackage('dexterity.membrane')
def setUp(cls): # load zcml fiveconfigure.debug_mode = True for pkg in packages: module = __import__(pkg) for comp in pkg.split('.')[1:]: module = getattr(module, comp) load_config('configure.zcml', module) fiveconfigure.debug_mode = False # install packages (products cannot be loaded from the layer) for pkg in packages: installPackage(pkg, quiet=quiet) # import profile root = app() prof = 'profile-%s' % profile tool = getToolByName(root.plone, 'portal_setup') tool.runAllImportStepsFromProfile(prof, purge_old=False) # login as admin (copied from `loginAsPortalOwner`) and # create some sample content uf = root.acl_users user = uf.getUserById(PloneTestCase.portal_owner).__of__(uf) newSecurityManager(None, user) if create: create(root.plone) # and commit the changes commit() close(root)
def afterSetUp(self): fiveconfigure.debug_mode = True from quintagroup import transmogrifier zcml.load_config('testing.zcml', transmogrifier) fiveconfigure.debug_mode = False installPackage('quintagroup.transmogrifier', quiet=True) self.addProfile('quintagroup.transmogrifier:default') self.createDemoContent()
def setup_product(): """Setting up the package and including the ZCML """ import sd.app fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', sd.app) fiveconfigure.debug_mode = False installPackage('sd.app')
def afterSetUp(self): from collective import indexing, solr zcml.load_config('configure.zcml', indexing) zcml.load_config('configure.zcml', solr) installPackage('collective.indexing', quiet=True) installPackage('collective.solr', quiet=True) self.addProfile('collective.solr:search') # account for difference in default content in Plone 4.0 / 4.1 _createObjectByType('Document', self.portal.events, 'previous')
def setUp(cls): metaconfigure.debug_mode = True import plone.app.customerize import plone.app.customerize.tests zcml.load_config('configure.zcml', plone.app.customerize) zcml.load_config('testing.zcml', plone.app.customerize.tests) zcml.load_config('duplicate_viewlet.zcml', plone.app.customerize.tests) metaconfigure.debug_mode = False installPackage('plone.app.customerize', quiet=True)
def afterSetUp(self): # load zcml... fiveconfigure.debug_mode = True from Products import ImageEditor zcml.load_config('testing.zcml', package=ImageEditor) fiveconfigure.debug_mode = False # initialize packages... installPackage('Products.ImageEditor', quiet=True) installPackage('collective.js.jqueryui', quiet=True) # quick-install... self.addProfile('Products.ImageEditor:default')
def afterSetUp(self): # load zcml... fiveconfigure.debug_mode = True import uwosh.northstar zcml.load_config('configure.zcml', package=uwosh.northstar) # initialize packages... installPackage('uwosh.northstar', quiet=True) installPackage('plone.app.jquerytools', quiet=True) # quick-install... self.addProfile('plone.app.jquerytools:default') self.addProfile('uwosh.northstar:default')
def setUp(cls): import zope.component import OFS import Products.Five zcml.load_config('meta.zcml', zope.component) try: zcml.load_config('meta.zcml', OFS) zcml.load_config('configure.zcml', OFS) except IOError: # Zope <= 2.13.0a2 zcml.load_config('meta.zcml', Products.Five) # In Zope 2.12 this does an implicit commit installPackage('OFS') setHooks()
def afterSetUp(self): # load zcml for this package... fiveconfigure.debug_mode = True from plone.app import linkintegrity zcml.load_config("configure.zcml", package=linkintegrity) fiveconfigure.debug_mode = False # after which it can be initialized... installPackage("plone.app.linkintegrity", quiet=True) # create sample content self.loginAsPortalOwner() gif = "R0lGODlhAQABAPAAAPj8+AAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" gif = StringIO(decodestring(gif)) portal = self.portal portal.invokeFactory( "Document", id="doc1", title="Test Page 1", text="<html> <body> a test page </body> </html>" ) portal.invokeFactory( "Document", id="doc2", title="Test Page 2", text="<html> <body> another test page </body> </html>" ) portal.invokeFactory("Image", id="image1", title="Test Image 1", image=gif) portal.invokeFactory("Image", id="image2", title="Test Image 2", image=gif) portal.invokeFactory("Image", id="image3", title="Test Image 3", image=gif) portal.invokeFactory("File", id="file1", title="Test File 1", file=gif) portal.invokeFactory("Folder", id="folder1", title="Test Folder 1") portal.folder1.invokeFactory( "Document", id="doc3", title="Test Page 3", text="<html> <body> a test page in a subfolder </body> </html>" ) portal.folder1.invokeFactory( "Document", id="doc4", title="Test Page 4", text="<html> <body> another test page </body> </html>" ) portal.folder1.invokeFactory( "Document", id="doc5", title="Test Page 5", text="<html> <body> another test page </body> </html>" ) # Unmark the creation flag so any calls processForm/setText will not # rename our content objects. This is mainly for getting the # tests running in combination with LinguaPlone. portal.doc1.unmarkCreationFlag() portal.doc2.unmarkCreationFlag() portal.image1.unmarkCreationFlag() portal.image2.unmarkCreationFlag() portal.image3.unmarkCreationFlag() portal.file1.unmarkCreationFlag() portal.folder1.unmarkCreationFlag() portal.folder1.doc3.unmarkCreationFlag() portal.folder1.doc4.unmarkCreationFlag() portal.folder1.doc5.unmarkCreationFlag() self.login()
def setUp(cls): from zope.component import provideAdapter from plone.app.viewletmanager.exportimport.storage import ViewletSettingsStorageNodeAdapter from Products.GenericSetup.interfaces import IBody from Products.GenericSetup.interfaces import ISetupEnviron metaconfigure.debug_mode = True import plone.app.vocabularies zcml.load_config('configure.zcml', plone.app.vocabularies) metaconfigure.debug_mode = False installPackage('plone.app.vocabularies', quiet=True) provideAdapter(factory=ViewletSettingsStorageNodeAdapter, adapts=(IViewletSettingsStorage, ISetupEnviron), provides=IBody)
def setUp(cls): fiveconfigure.debug_mode = True import collective.classification zcml.load_config('configure.zcml', collective.classification) fiveconfigure.debug_mode = False installPackage('collective.classification',quiet=True) # import the default profile root = app() portal = root.plone tool = getToolByName(portal, 'portal_setup') profile = 'profile-collective.classification:default' tool.runAllImportStepsFromProfile(profile, purge_old=False) # and commit the changes commit() close(root)
def afterSetUp(self): from Testing.ZopeTestCase import installPackage import tno.euphorie self.loadZCML("configure.zcml", package=tno.euphorie) installPackage("tno.euphorie") self.addProduct("tno.euphorie") # Reinstalling tno.euphorie zaps the membrane_tool contens, so manually # reindex the client. self.portal.membrane_tool.indexObject(self.portal.client) import tno.euphorie.model assert tno.euphorie.model._instrumented from euphorie.client import model from z3c.saconfig import Session model.metadata.create_all(Session.bind, checkfirst=True)
def setUp(cls): metaconfigure.debug_mode = True import collective.megaphone zcml.load_config('configure.zcml', collective.megaphone) if HAS_SALESFORCE: import Products.salesforcepfgadapter zcml.load_config('configure.zcml', Products.salesforcepfgadapter) metaconfigure.debug_mode = False installPackage('plone.app.z3cform') installPackage('collective.megaphone') root = app() portal = root.plone # set up sessions ztc.utils.setupCoreSessions(root) root.REQUEST.SESSION = Session() # add Salesforce base connector if HAS_SALESFORCE: portal.manage_addProduct['salesforcebaseconnector'].manage_addTool('Salesforce Base Connector', None) portal.portal_salesforcebaseconnector.setCredentials(sfconfig.USERNAME, sfconfig.PASSWORD) # add root user root.acl_users.userFolderAddUser('root', 'secret', ['Manager'], []) # import profiles setHooks() setSite(portal) tool = getToolByName(portal, 'portal_setup') tool.runAllImportStepsFromProfile('profile-collective.megaphone:default', purge_old=False) if HAS_SALESFORCE: tool.runAllImportStepsFromProfile('profile-Products.salesforcepfgadapter:default', purge_old=False) setSite(None) # use mock mailhost portal.MailHost = MockMailHost('MailHost') portal.email_from_address = '*****@*****.**' # and commit the changes commit() close(root)
def setUp(cls): root = app() portal = root.plone # load zcml & install the package metaconfigure.debug_mode = True from plone.app.folder import tests load_config('testing.zcml', tests) metaconfigure.debug_mode = False installPackage('plone.app.folder', quiet=True) # import replacement profile profile = 'profile-plone.app.folder:default' tool = getToolByName(portal, 'portal_setup') tool.runAllImportStepsFromProfile(profile, purge_old=False) # make sure it's loaded... types = getToolByName(portal, 'portal_types') assert types.getTypeInfo('Folder').product == 'plone.app.folder' # and commit the changes commit() close(root)
def setUp(cls): """ setUp """ root = app() portal = root.plone # load zcml & install the package metaconfigure.debug_mode = True import eea.jquery load_config('configure.zcml', eea.jquery) load_config('testing.zcml', eea.jquery) metaconfigure.debug_mode = False installPackage('eea.jquery', quiet=True) # import jquery profiles profile = 'profile-eea.jquery:all' tool = getToolByName(portal, 'portal_setup') tool.runAllImportStepsFromProfile(profile, purge_old=False) # and commit the changes commit() close(root)
def afterSetUp(self): from Testing.ZopeTestCase import installPackage installPackage('d3kod.restapi') from d3kod.restapi import tests self.loadZCML('configure.zcml', package=tests) self.addProfile('d3kod.restapi:default') self.browser = Browser() self.browser.handleErrors = False self.portal.error_log._ignored_exceptions = () def raising(self, info): import traceback traceback.print_tb(info[2]) print info[1] from Products.SiteErrorLog.SiteErrorLog import SiteErrorLog SiteErrorLog.raising = raising
def setUp(cls): # load zcml metaconfigure.debug_mode = True from plone.app.blob import tests zcml.load_config('testing.zcml', tests) from Products import LinguaPlone zcml.load_config('configure.zcml', LinguaPlone) metaconfigure.debug_mode = False # install packages, import profiles... installPackage('plone.app.blob', quiet=True) installProduct('LinguaPlone', quiet=True) root = app() portal = root.plone profile = 'profile-plone.app.blob:testing-lingua' tool = getToolByName(portal, 'portal_setup') tool.runAllImportStepsFromProfile(profile, purge_old=False) # make sure it's loaded... types = getToolByName(portal, 'portal_types') assert types.getTypeInfo('BlobelFish') # and commit the changes commit() close(root)
def setUp(cls): # load zcml & install packages metaconfigure.debug_mode = True from plone.app import imaging zcml.load_config('configure.zcml', imaging) metaconfigure.debug_mode = False installPackage('plone.app.imaging', quiet=True) # import replacement profiles root = app() portal = root.plone tool = getToolByName(portal, 'portal_setup') for name in 'file-replacement', 'image-replacement': profile = 'profile-plone.app.blob:%s' % name tool.runAllImportStepsFromProfile(profile, purge_old=False) # make sure it's loaded... types = getToolByName(portal, 'portal_types') assert types.getTypeInfo('File').product == 'plone.app.blob' # allow creating the replaced types types.getTypeInfo('ATFile').global_allow = True types.getTypeInfo('ATImage').global_allow = True # and commit the changes commit() close(root)
def setUp(cls): # Please be aware that part of the setup of tests # is the import of db in the __init__ file in # the same module as this class. # For more information, look at testing3rdparty.txt # load zcml & install packages metaconfigure.debug_mode = True from plone.app.blob import tests zcml.load_config('testing.zcml', tests) metaconfigure.debug_mode = False installPackage('plone.app.blob', quiet=True) # import the default profile root = app() portal = root.plone tool = getToolByName(portal, 'portal_setup') profile = 'profile-plone.app.blob:sample-type' tool.runAllImportStepsFromProfile(profile, purge_old=False) # make sure it's loaded... types = getToolByName(portal, 'portal_types') assert types.getTypeInfo('Blob').product == 'plone.app.blob' # and commit the changes commit() close(root)
def register_package(): import wicked.atcontent zcml.load_config("configure.zcml", package=wicked.atcontent) installPackage('wicked.atcontent')
def installService(): # Load our ZCML, which add the extension as a Product from silva import searchandreplace zcml.load_config('configure.zcml', searchandreplace) installPackage('silva.searchandreplace')
def setUp(cls): metaconfigure.debug_mode = True import plone.app.portlets zcml.load_config('configure.zcml', plone.app.portlets) metaconfigure.debug_mode = False installPackage('plone.app.portlets', quiet=True)
def afterSetUp(self): from euphorie.client import tests from Testing.ZopeTestCase import installPackage import euphorie.deployment import osha.oira import pas.plugins.ldap self.loadZCML("configure.zcml", package=pas.plugins.ldap) self.loadZCML("configure.zcml", package=euphorie.deployment) self.loadZCML("overrides.zcml", package=euphorie.deployment) self.loadZCML("configure.zcml", package=tests) self.loadZCML("configure.zcml", package=osha.oira) installPackage("plone.uuid") installPackage("collective.indexing") installPackage("plone.app.dexterity") installPackage("plone.app.folder") installPackage("pas.plugins.ldap") installPackage("euphorie.content") installPackage("euphorie.client") installPackage("euphorie.deployment") installPackage("plonetheme.nuplone") installPackage("osha.oira") self.addProduct("euphorie.deployment") self.addProduct("osha.oira") model.metadata.create_all(Session.bind, checkfirst=True) appconfig = getUtility(IAppConfig) appconfig.loadConfig(TEST_INI, clear=True)
def afterSetUp(self): from Testing.ZopeTestCase import installPackage from euphorie.client import tests import euphorie.deployment import osha.oira self.loadZCML("configure.zcml", package=euphorie.deployment) self.loadZCML("overrides.zcml", package=euphorie.deployment) self.loadZCML("configure.zcml", package=tests) self.loadZCML("configure.zcml", package=osha.oira) installPackage("plone.uuid") installPackage("collective.indexing") installPackage("plone.app.dexterity") installPackage("plone.app.folder") installPackage("euphorie.content") installPackage("euphorie.client") installPackage("euphorie.deployment") installPackage("plonetheme.nuplone") installPackage("osha.oira") self.addProduct("euphorie.deployment") self.addProduct("osha.oira") model.metadata.create_all(Session.bind, checkfirst=True) appconfig = getUtility(IAppConfig) appconfig.loadConfig(TEST_INI, clear=True)
# -*- coding: utf-8 -*- # helper module to ease setting up backward-compatibility tests for # ATContentTypes and CMFPlone from Products.Five import fiveconfigure from Testing.ZopeTestCase import installPackage from Testing.ZopeTestCase import installProduct from Zope2.App.zcml import load_config installProduct('Five', quiet=True) fiveconfigure.debug_mode = True import plone.app.folder load_config('configure.zcml', plone.app.folder) fiveconfigure.debug_mode = False installPackage('plone.app.folder', quiet=True)
# helper module to ease setting up backward-compatibility tests for # ATContentTypes and CMFPlone from Testing.ZopeTestCase import installProduct, installPackage # BBB Zope 2.12 try: from Zope2.App.zcml import load_config load_config # pyflakes except ImportError: from Products.Five.zcml import load_config from Products.Five import fiveconfigure installProduct('Five', quiet=True) fiveconfigure.debug_mode = True import plone.app.folder load_config('configure.zcml', plone.app.folder) fiveconfigure.debug_mode = False installPackage('plone.app.folder', quiet=True)
def afterSetUp(self): from Testing.ZopeTestCase import installPackage import euphorie.deployment import euphorie.client.tests self.loadZCML("configure.zcml", package=euphorie.deployment) self.loadZCML("overrides.zcml", package=euphorie.deployment) self.loadZCML("configure.zcml", package=euphorie.client.tests) installPackage("plone.uuid") installPackage("collective.indexing") installPackage("plone.app.dexterity") installPackage("plone.app.folder") installPackage("euphorie.content") installPackage("euphorie.client") installPackage("euphorie.deployment") installPackage("plonetheme.nuplone") self.addProduct("euphorie.deployment") from euphorie.client import model from z3c.saconfig import Session model.metadata.create_all(Session.bind, checkfirst=True) from zope.component import getUtility from z3c.appconfig.interfaces import IAppConfig appconfig = getUtility(IAppConfig) appconfig.loadConfig(TEST_INI, clear=True)
from Products.Five import zcml, fiveconfigure from Testing.ZopeTestCase import installPackage, hasPackage from Products.PloneTestCase import PloneTestCase from Products.CMFCore.utils import getToolByName from Products.CMFCore.permissions import ManagePortal from Products.CMFQuickInstallerTool.InstalledProduct import InstalledProduct from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager import quintagroup.seoptimizer from quintagroup.seoptimizer.config import * zcml.load_site() zcml.load_config('overrides.zcml', quintagroup.seoptimizer) zcml.load_config('configure.zcml', quintagroup.seoptimizer) PRODUCT = 'quintagroup.seoptimizer' installPackage(PRODUCT) props = {'stop_words':STOP_WORDS, 'fields':FIELDS, 'additional_keywords': []} custom_metatags = [{'meta_name' : 'metatag1', 'meta_content' : 'metatag1value'}, {'meta_name' : 'metatag2', 'meta_content' : 'metatag2value'}] configlets = ({'id':'qSEOptimizer', 'name':'Search Engine Optimizer', 'action':'string:${portal_url}/seo-controlpanel', 'condition':'', 'category':'Products', 'visible':1, 'appId':'qSEOptimizer', 'permission':ManagePortal},)
def afterSetUp(self): # load zcml for this package... fiveconfigure.debug_mode = True from plone.app import linkintegrity zcml.load_config('configure.zcml', package=linkintegrity) fiveconfigure.debug_mode = False # after which it can be initialized... installPackage('plone.app.linkintegrity', quiet=True) # create sample content self.loginAsPortalOwner() gif = 'R0lGODlhAQABAPAAAPj8+AAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==' gif = StringIO(decodestring(gif)) portal = self.portal portal.invokeFactory('Document', id='doc1', title='Test Page 1', text='<html> <body> a test page </body> </html>') portal.invokeFactory( 'Document', id='doc2', title='Test Page 2', text='<html> <body> another test page </body> </html>') portal.invokeFactory('Image', id='image1', title='Test Image 1', image=gif) portal.invokeFactory('Image', id='image2', title='Test Image 2', image=gif) portal.invokeFactory('Image', id='image3', title='Test Image 3', image=gif) portal.invokeFactory('File', id='file1', title='Test File 1', file=gif) portal.invokeFactory('Folder', id='folder1', title='Test Folder 1') portal.folder1.invokeFactory( 'Document', id='doc3', title='Test Page 3', text='<html> <body> a test page in a subfolder </body> </html>') portal.folder1.invokeFactory( 'Document', id='doc4', title='Test Page 4', text='<html> <body> another test page </body> </html>') portal.folder1.invokeFactory( 'Document', id='doc5', title='Test Page 5', text='<html> <body> another test page </body> </html>') # Unmark the creation flag so any calls processForm/setText will not # rename our content objects. This is mainly for getting the # tests running in combination with LinguaPlone. portal.doc1.unmarkCreationFlag() portal.doc2.unmarkCreationFlag() portal.image1.unmarkCreationFlag() portal.image2.unmarkCreationFlag() portal.image3.unmarkCreationFlag() portal.file1.unmarkCreationFlag() portal.folder1.unmarkCreationFlag() portal.folder1.doc3.unmarkCreationFlag() portal.folder1.doc4.unmarkCreationFlag() portal.folder1.doc5.unmarkCreationFlag() self.login()