def setUp(self): import Products.ZenossStartup from Products.Five import zcml zcml.load_site() zope.component.provideAdapter(DefaultTraversable, (None,)) if not self.conn: adapter_config = self._find_relstorage_adapter_config() if adapter_config: self.conn = ZeoConn(zodb_host=adapter_config.host, zodb_port=adapter_config.port, zodb_user=adapter_config.user, zodb_password=adapter_config.passwd, zodb_db=adapter_config.db, zodb_socket=adapter_config.unix_socket) else: self.conn = ZeoConn() self.app = self.conn.app self.login() self.dmd = self.app.zport.dmd find = self.dmd.Devices.findDevice self.globals = dict( app = self.app, zport = self.app.zport, dmd = self.dmd, find = find, devices = self.dmd.Devices, sync = self.dmd._p_jar.sync, commit = transaction.commit, abort = transaction.abort, me = find(socket.getfqdn()) )
def setUp(self): import Products.ZenossStartup from Products.Five import zcml zcml.load_site() zope.component.provideAdapter(DefaultTraversable, (None, )) if not self.conn: adapter_config = self._find_relstorage_adapter_config() if adapter_config: self.conn = ZeoConn(zodb_host=adapter_config.host, zodb_port=adapter_config.port, zodb_user=adapter_config.user, zodb_password=adapter_config.passwd, zodb_db=adapter_config.db, zodb_socket=adapter_config.unix_socket) else: self.conn = ZeoConn() self.app = self.conn.app self.login() self.dmd = self.app.zport.dmd find = self.dmd.Devices.findDevice self.globals = dict(app=self.app, zport=self.app.zport, dmd=self.dmd, find=find, devices=self.dmd.Devices, sync=self.dmd._p_jar.sync, commit=transaction.commit, abort=transaction.abort, me=find(socket.getfqdn()))
def afterSetUp(self): cleanup.cleanUp() zcml._initialized = False zcml.load_site() self.saved = sys.path[:] sys.path.append(ZopeTestCase.__path__[0])
def safe_load_site(): """Load entire component architecture (w/ debug mode on)""" cleanUp() setDebugMode(1) import Products.Five.zcml as zcml zcml.load_site() setDebugMode(0)
def setUp(cls): # this keeps five from hiding config errors while toggle debug # back on to let PTC perform efficiently setDebugMode(1) from Products.Five import zcml zcml.load_site() setDebugMode(0)
def safe_load_site(): '''Loads entire component architecture (w/ debug mode on).''' cleanUp() setDebugMode(1) import Products.Five.zcml as zcml zcml.load_site() zcml.load_config('ftesting.zcml', five.megrok.z3cpt) setDebugMode(0)
def setUp(cls): import Products zcml._initialized = 0 zcml.load_site() setHooks() component.provideHandler(eventlog.trace, (ITestItem, IObjectEvent)) component.provideHandler(eventlog.trace, (IRelationship, IObjectEvent))
def setUp(cls): cfg = getConfiguration() cfg.product_config = {'munin.zope': {'secret': 'muninsecret'}} # load zcml & install package fiveconfigure.debug_mode = True import munin.zope zcml.load_site() zcml.load_config('configure.zcml', munin.zope) fiveconfigure.debug_mode = False
def loadSite(): """Loads extension. """ cleanUp() setDebugMode(1) import Products.Five.zcml as zcml zcml.load_site() zcml.load_config('meta.zcml', five.resourceinclude) zcml.load_config('configure.zcml', five.resourceinclude) setDebugMode(0)
def setup_product(): fiveconfigure.debug_mode = True ZopeLite.installProduct('Five', quiet=1) zcml.load_site() configure_vocabulary_registry() import Products.CMFCore import Products.Five import Products.GenericSetup import zope.i18n import netsight.async
def setup_product(): fiveconfigure.debug_mode = True ZopeLite.installProduct('Five', quiet=1) zcml.load_site() configure_vocabulary_registry() import Products.CMFCore import Products.Five import Products.GenericSetup import zope.i18n import netsight. async
def __init__(self, noopts=0, args=None, should_log=None): zope.component.provideAdapter(DefaultTraversable, (None, )) # This explicitly loads all of the products - must happen first! from OFS.Application import import_products import_products() #make sure we aren't in debug mode import Globals Globals.DevelopmentMode = False # We must import ZenossStartup at this point so that all Zenoss daemons # and tools will have any ZenPack monkey-patched methods available. import Products.ZenossStartup unused(Products.ZenossStartup) zcml.load_site() import Products.ZenWidgets load_config_override('scriptmessaging.zcml', Products.ZenWidgets) self.usage = "%prog [options]" self.noopts = noopts self.inputArgs = args # inputArgs was created to allow unit tests to pass in command line # arguments and get around whatever Zope was doing to sys.argv. if self.inputArgs is None: self.inputArgs = sys.argv[1:] self.parser = None self.args = [] self.buildParser() self.buildOptions() # Get defaults from global.conf. They will be overridden by # daemon-specific config file or command line arguments. applyGlobalConfToParser(self.parser) self.parseOptions() if self.options.configfile: self.parser.defaults = self.getConfigFileDefaults( self.options.configfile) # We've updated the parser with defaults from configs, now we need # to reparse our command-line to get the correct overrides from # the command-line self.parseOptions() if should_log is not None: self.doesLogging = should_log if self.doesLogging: self.setupLogging()
def __init__(self, noopts=0, args=None): zope.component.provideAdapter(DefaultTraversable, (None,)) # This explicitly loads all of the products - must happen first! from OFS.Application import import_products import_products() # make sure we aren't in debug mode import Globals Globals.DevelopmentMode = False # We must import ZenossStartup at this point so that all Zenoss daemons # and tools will have any ZenPack monkey-patched methods available. import Products.ZenossStartup unused(Products.ZenossStartup) zcml.load_site() import Products.ZenWidgets load_config_override("scriptmessaging.zcml", Products.ZenWidgets) self.usage = "%prog [options]" self.noopts = noopts self.inputArgs = args # inputArgs was created to allow unit tests to pass in command line # arguments and get around whatever Zope was doing to sys.argv. if self.inputArgs is None: self.inputArgs = sys.argv[1:] self.parser = None self.args = [] self.buildParser() self.buildOptions() # Get defaults from global.conf. They will be overridden by # daemon-specific config file or command line arguments. applyGlobalConfToParser(self.parser) self.parseOptions() if self.options.configfile: self.parser.defaults = self.getConfigFileDefaults(self.options.configfile) # We've updated the parser with defaults from configs, now we need # to reparse our command-line to get the correct overrides from # the command-line self.parseOptions() if self.doesLogging: self.setupLogging()
def afterSetUp(self): # Upgrade the UserFolder to a PAS from Products.PluggableAuthService.Extensions.upgrade import replace_acl_users replace_acl_users(self.app.test_folder_1_) from Products.PluggableAuthService.interfaces.plugins import IGroupsPlugin, IGroupEnumerationPlugin, IUserEnumerationPlugin, IAuthenticationPlugin, IRolesPlugin from Products.PluggableAuthService.interfaces.plugins import ICredentialsUpdatePlugin, ICredentialsResetPlugin, IExtractionPlugin, IChallengePlugin self.uf = self.app.test_folder_1_.acl_users self.uf.roles.assignRoleToPrincipal('Manager', user_name) plugins = self.uf.plugins factory = self.uf.manage_addProduct['PluggableAuthService'] if not self.uf.hasObject('groups'): factory.addZODBGroupManager('groups') plugins.activatePlugin(IGroupsPlugin, 'groups') plugins.activatePlugin(IGroupEnumerationPlugin, 'groups') if not self.uf.hasObject('cookies'): factory.addCookieAuthHelper('cookies') #plugins.activatePlugin(ICredentialsUpdatePlugin, 'cookies') #plugins.activatePlugin(ICredentialsResetPlugin, 'cookies') plugins.activatePlugin(IExtractionPlugin, 'cookies') if not self.uf.hasObject('basic_auth'): factory.addHTTPBasicAuthHelper('basic_auth') #plugins.activatePlugin(ICredentialsUpdatePlugin, 'cookies') #plugins.activatePlugin(ICredentialsResetPlugin, 'cookies') plugins.activatePlugin(IExtractionPlugin, 'basic_auth') plugins.activatePlugin(IChallengePlugin, 'basic_auth') zcml.load_site() zcml.load_config('configure.zcml', jcu.shibboleth.pas) installPackage('jcu.shibboleth.pas') # Add the session objects ZopeTestCase.utils.setupCoreSessions(self.app) from jcu.shibboleth.pas.plugin import ShibbolethHelper shib = ShibbolethHelper('shib', 'Shibboleth Helper') self.app.test_folder_1_.acl_users['shib'] = shib plugins.activatePlugin(IExtractionPlugin, 'shib') plugins.activatePlugin(IAuthenticationPlugin, 'shib') plugins.activatePlugin(IChallengePlugin, 'shib') plugins.activatePlugin(IRolesPlugin, 'shib') plugins.activatePlugin(IUserEnumerationPlugin, 'shib') #plugins.activatePlugin(IChallengePlugin, 'basic_auth') # Setup attribute map resolver path = os.path.dirname(jcu.shibboleth.pas.__file__) self.app.test_folder_1_.acl_users.shib.shibboleth_config_dir = os.path.join(path, 'tests', 'shib2')
def __init__(self, app): """ Initializer @param app: app @type app: string """ import Products.ZenossStartup from Products.Five import zcml zcml.load_site() import logging self.log = logging.getLogger('zen.ImportRM') self.app = app ContentHandler.__init__(self) self.options = SpoofedOptions() self.dataroot = None self.getDataRoot()
def afterSetUp(self): # Upgrade the UserFolder to a PAS from Products.PluggableAuthService.Extensions.upgrade import replace_acl_users replace_acl_users(self.app.test_folder_1_) from Products.PluggableAuthService.interfaces.plugins import IGroupsPlugin, IGroupEnumerationPlugin self.uf = self.app.test_folder_1_.acl_users self.uf.roles.assignRoleToPrincipal('Manager', user_name) if not self.uf.hasObject('groups'): factory = self.uf.manage_addProduct['PluggableAuthService'] factory.addZODBGroupManager('groups') plugins = self.uf.plugins plugins.activatePlugin(IGroupsPlugin, 'groups') plugins.activatePlugin(IGroupEnumerationPlugin, 'groups') zcml.load_site() installPackage('jcu.shibboleth.pas') # Add the session objects ZopeTestCase.utils.setupCoreSessions(self.app)
from Products.ZenMessaging.queuemessaging.interfaces import IQueuePublisher from Products.ZenEvents.zeneventmigrate import ZenEventMigrate from Products.ZenUtils.guid.interfaces import IGlobalIdentifier from ConfigParser import ConfigParser from datetime import datetime from itertools import repeat import re import logging log = logging.getLogger('zen.testEventMigrate') #lookup import Globals from Products.Five import zcml import Products.ZenossStartup zcml.load_site() class MockChannel(object): """ Mocks out an AMQP channel. """ def tx_select(self): pass def tx_commit(self): pass class MockPublisher(object): """
def setUp(self): super(PageSecurityTestCase, self).setUp() zcml.reset() zcml.load_site() self.dummy1 = Dummy1
def initialize(context): zcml.load_site()
def setUp(cls): cleanup.cleanUp() zcml._initialized = 0 zcml.load_site() component.provideHandler(eventlog.trace, (ITestItem, IObjectEvent)) component.provideHandler(eventlog.trace, (ITestFolder, IObjectEvent))
def setUp(cls): cleanup.cleanUp() zcml._initialized = 0 zcml.load_site()
import re import string import urllib from zope.component import getMultiAdapter 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':'',