Example #1
0
def setup():
    import pmr2.git
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', pmr2.git)
    zcml.load_config('test.zcml', pmr2.testing)
    fiveconfigure.debug_mode = False
    ztc.installPackage('pmr2.app')
Example #2
0
 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')
Example #3
0
def setup():
    import pmr2.oauth
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', pmr2.oauth)
    zcml.load_config('tests.zcml', pmr2.oauth.tests)
    fiveconfigure.debug_mode = False
    ztc.installPackage('pmr2.oauth')
Example #4
0
def setup():
    import pmr2.annotation.curation

    fiveconfigure.debug_mode = True
    zcml.load_config("configure.zcml", pmr2.annotation.curation)
    fiveconfigure.debug_mode = False
    ztc.installPackage("pmr2.annotation.curation")
Example #5
0
    def setUp(self):

        # Setup sandbox
        self.portal = self.layer['portal']
        self.request = self.layer['request']
        self.registry = EventsRegistry

        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        self.document = self.portal['doc1']

        #
        # Subscribers
        #
        configure = """
        <configure
          xmlns="http://namespaces.zope.org/zope">

          <subscriber
            for="OFS.interfaces.ISimpleItem
                 plone.app.discussion.interfaces.ICommentAddedEvent"
            handler="plone.app.discussion.tests.test_events.comment_added"
            />

          <subscriber
            for="OFS.interfaces.ISimpleItem
                 plone.app.discussion.interfaces.ICommentRemovedEvent"
            handler="plone.app.discussion.tests.test_events.comment_removed"
            />

         </configure>
        """
        zcml.load_config('configure.zcml', Products.Five)
        zcml.load_string(configure)
Example #6
0
 def setUp(cls):
     metaconfigure.debug_mode = True
     from Products import contentmigration
     zcml.load_config('testing.zcml', package=contentmigration)
     zcml.load_config('testing-schemaextender.zcml',
                      package=contentmigration)
     metaconfigure.debug_mode = False
    def setUp(self):
        componenttesting.setUp()
        eventtesting.setUp()
        zcml.load_config("meta.zcml", zope.component)
        zcml.load_config("configure.zcml", Products.StandardCacheManagers)

        folder1, folder2 = self._initFolders()

        folder1.all_meta_types = folder2.all_meta_types = CACHE_META_TYPES

        self.folder1 = folder1
        self.folder2 = folder2

        self.policy = UnitTestSecurityPolicy()
        self.oldPolicy = SecurityManager.setSecurityPolicy(self.policy)

        cm_id = "cache"
        manager = self._makeOne(cm_id)
        self.folder1._setObject(cm_id, manager)
        self.cachemanager = self.folder1[cm_id]
        transaction.savepoint(optimistic=True)

        newSecurityManager(None, UnitTestUser().__of__(self.root))

        CopySupportTestBase.setUp(self)
Example #8
0
    def testSetUp(cls):
        import Products.Five
        import zope.traversing

        zcml.load_config('meta.zcml', Products.Five)
        zcml.load_config('configure.zcml', zope.traversing)
        setHooks()
Example #9
0
def setup():
    import pmr2.z3cform
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', pmr2.z3cform)
    zcml.load_config('testing.zcml', pmr2.z3cform.tests)
    fiveconfigure.debug_mode = False
    ztc.installPackage('pmr2.z3cform')
Example #10
0
def setup():
    import pmr2.app.annotation
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', pmr2.app.annotation)
    zcml.load_config(join('tests', 'test.zcml'), pmr2.app.annotation)
    fiveconfigure.debug_mode = False
    ztc.installPackage('pmr2.app')
Example #11
0
def install_deferred():
    # Temporarily patch fiveconfigure with findProducts able to see only
    # products under reload paths and execute Five configuration directives
    import sauna.reload
    import Products.Five.fiveconfigure
    setattr(Products.Five.fiveconfigure, "findProducts", findDeferredProducts)
    load_config("fiveconfigure.zcml", sauna.reload)
    setattr(Products.Five.fiveconfigure, "findProducts", findProducts)

    # Five pushes old-style product initializations into
    # Products._packages_to_initialize-list. We must loop through that list
    # for our reloaded packages and try to install them.
    import Products
    from App.config import getConfiguration
    from OFS.Application import install_package
    from Zope2.App.startup import app
    # FIXME: Is this really the only way to get our app-object?
    app = app()  # XXX: Help! Should we use use app._p_jar-stuff around here?
    debug_mode = getConfiguration().debug_mode
    from sauna.reload import reload_paths
    for module, init_func in getattr(Products, "_packages_to_initialize", []):
        if getattr(module, "__file__") in reload_paths:
            install_package(app, module, init_func, raise_exc=debug_mode)
    if hasattr(Products, "_packages_to_initialize"):
        del Products._packages_to_initialize
    def testPhotos(self):

        # vipod (from irc channel): temporary fix to show IAnnotations problem:
        # default IAnnotations adapter wasn't registered so I'm registering it
        # here by manually including zope.annotation configuration,
        # actually imgs() method uses too many plone functions, so to override
        # all this behaviour you'll also need to patch getToolByName which is
        # used by this method, thus I think it'd be easier to implement this
        # testcase as integrational, inherited from PloneTestCase
        try:
            from Zope2.App.zcml import load_config
        except ImportError:
            from Products.Five.zcml import load_config
        import zope.component
        import zope.annotation

        load_config('meta.zcml', zope.component)
        load_config('configure.zcml', zope.annotation)

        imgs = self.view.photos()
        self.assertEqual(len(imgs), 2)

        for img in imgs:
            test, msg = utils.verifyImage(img)
            self.assertTrue(test, msg)
Example #13
0
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 pp.demo
    import zopyx.authoring
    zcml.load_config('configure.zcml', zopyx.authoring)
    zcml.load_config('configure.zcml', pp.demo)
    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('zopyx.authoring')
    ztc.installPackage('pp.demo')
Example #14
0
def loadZCMLFile(config, package=None, execute=True):
    # Unset current site for Zope 2.13
    saved = getSite()
    setSite(None)
    try:
        zcml.load_config(config, package, execute)
    finally:
        setSite(saved)
Example #15
0
def setup():
    import pmr2.citations
    import pmr2.citations.tests

    fiveconfigure.debug_mode = True
    load_config("configure.zcml", pmr2.citations)
    load_config("test.zcml", pmr2.citations.tests)
    fiveconfigure.debug_mode = False
Example #16
0
def setup():
    import pmr2.app
    fiveconfigure.debug_mode = True
    # XXX dependant on pmr2.app still
    zcml.load_config('configure.zcml', pmr2.app)
    zcml.load_config('test.zcml', pmr2.app.workspace.tests)
    fiveconfigure.debug_mode = False
    ztc.installPackage('pmr2.app')
Example #17
0
def setup():
    import pmr2.captcha

    fiveconfigure.debug_mode = True
    zcml.load_config("configure.zcml", pmr2.captcha)
    zcml.load_config("test.zcml", pmr2.captcha.tests)
    fiveconfigure.debug_mode = False
    ztc.installPackage("pmr2.captcha")
Example #18
0
 def setUp(self):
     super(ObjectManagerTests, self).setUp()
     self.saved_cfg_debug_mode = getConfiguration().debug_mode
     import Zope2.App
     zcml.load_config('meta.zcml', Zope2.App)
     import OFS
     zcml.load_config('configure.zcml', OFS)
     setDeprecatedManageAddDelete(ItemForDeletion)
Example #19
0
def setup_rdfmarshaller():
    """ Setup """

    fiveconfigure.debug_mode = True
    load_config('configure.zcml', eea.rdfmarshaller)
    load_config('testing.zcml', eea.rdfmarshaller)

    fiveconfigure.debug_mode = False
Example #20
0
def setUp(self):
    from Zope2.App.schema import configure_vocabulary_registry
    configure_vocabulary_registry()

    zcml.load_config('browser_testing.zcml', plone.schemaeditor.tests)

    # add a test layer to the request so we can use special form templates
    # that don't pull in main_template
    classImplements(BaseRequest, ITestLayer)
Example #21
0
def setup():
    import pmr2.app
    import cellml.pmr2
    fiveconfigure.debug_mode = True
    # XXX dependant on pmr2.app still
    zcml.load_config('configure.zcml', cellml.pmr2)
    zcml.load_config('test.zcml', cellml.pmr2.tests)
    fiveconfigure.debug_mode = False
    ztc.installPackage('cellml.pmr2')
Example #22
0
def setupPackage():
    metaconfigure.debug_mode = True
    import Products.ResourceRegistries.tests
    load_config('test.zcml', Products.ResourceRegistries.tests)
    metaconfigure.debug_mode = False

    from Products.CMFCore.DirectoryView import registerFileExtension
    from Products.CMFCore.FSFile import FSFile
    registerFileExtension('kss', FSFile)
Example #23
0
def setup_eea_relations():
    """Set up the additional products. """
    fiveconfigure.debug_mode = True
    import eea.relations

    zcml.load_config("configure.zcml", eea.relations)
    fiveconfigure.debug_mode = False

    PloneTestCase.installPackage("eea.relations")
 def setUp(cls):
     metaconfigure.debug_mode = True
     import collective.editskinswitcher
     zcml.load_config('configure.zcml',
                      collective.editskinswitcher)
     zcml.load_config('testing-skins.zcml',
                      collective.editskinswitcher)
     metaconfigure.debug_mode = False
     ztc.installPackage('collective.editskinswitcher')
Example #25
0
 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_product():
    """Set up the package and its dependencies."""

    fiveconfigure.debug_mode = True
    from collective.geo import contentlocations

    zcml.load_config('configure.zcml', contentlocations)

    fiveconfigure.debug_mode = False
Example #27
0
def setup_mediacentre():
    """ Setup media centre
    """
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', eea.mediacentre)
    fiveconfigure.debug_mode = False

    PloneTestCase.installPackage('valentine.linguaflow')
    PloneTestCase.installPackage('ATVocabularyManager')
    PloneTestCase.installPackage('eea.themcentre')
Example #28
0
def setup_product():
    fiveconfigure.debug_mode = True
    import minaraad.projects
    zcml.load_config('configure.zcml', minaraad.projects)
    import Products.SimpleAttachment
    zcml.load_config('configure.zcml', Products.SimpleAttachment)
    fiveconfigure.debug_mode = False

    ztc.installPackage('minaraad.projects')
    ztc.installPackage('Products.SimpleAttachment')
Example #29
0
def setup_product():
    """
       Set up the package and its dependencies.
    """

    fiveconfigure.debug_mode = True
    import collective.geo.openlayers
    zcml.load_config('configuretest.zcml', collective.geo.openlayers)

    fiveconfigure.debug_mode = False
 def setUp(self):
     try:
         import Products.CMFCore
         zcml.load_config('meta.zcml', Products.CMFCore)
     except ImportError:
         pass
     import Products.LDAPUserFolder
     super(LDAPUserFolderXMLAdapterTests, self).setUp()
     zcml.load_config('configure.zcml', Products.LDAPUserFolder)
     self._obj = LDAPUserFolder()
     self._BODY = _LDAPUSERFOLDER_BODY
Example #31
0
def load_package_products():
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', pas.plugins.aselect)
    ptc.installPackage('pas.plugins.aselect')
    fiveconfigure.debug_mode = False
Example #32
0
def runner(args={}, pipeline=None):

    parser = OptionParser()

    parser.add_option("--pipeline",
                      dest="pipeline",
                      help="Transmogrifier pipeline.cfg to use",
                      metavar="FILE")
    parser.add_option("--show-pipeline",
                      dest="showpipeline",
                      action="store_true",
                      help="Show contents of the pipeline")
    parser.add_option("--zcml",
                      dest="zcml",
                      action="store",
                      help="modules in the path to load zcml from")
    # Parse just the pipeline args
    ispipeline = lambda arg: [
        a for a in ['--pipeline', '--show-pipeline', '--zcml']
        if arg.startswith(a)
    ]
    pargs = [arg for arg in sys.argv[1:] if ispipeline(arg)]
    (options, cargs) = parser.parse_args(pargs)
    if options.pipeline is not None:
        config = options.pipeline
    elif pipeline is not None:
        config = pipeline
    else:
        # XXX How about if we look for pipeline.cfg in the cwd?
        # config = resource_filename(__name__, 'pipeline.cfg')
        config = 'pipeline.cfg'

    # XXX This delays loading a bit too long. Getting:
    # ConfigurationError: ('Unknown directive',
    # u'http://namespaces.zope.org/genericsetup', u'importStep')
    # again
    #
    load_config('configure.zcml', mr.migrator)
    if options.zcml:
        for zcml in options.zcml.split(','):
            if not zcml.strip():
                continue
            load_config('configure.zcml',
                        __import__(zcml, fromlist=zcml.split('.')))

    pipelineid, cparser = load_pipeline(config, parser)

    pargs = [arg for arg in sys.argv[1:] if not arg.startswith('--template')]
    (options, cargs) = parser.parse_args(pargs)

    cargs = {}
    for k, _, v in [a.partition('=') for a in sys.argv[1:]]:
        k = k.lstrip('--')
        if ':' in k:
            part, _, key = k.partition(':')
            if key.lower() == 'debug':
                logger = logging.getLogger(part)
                logger.setLevel(logging.DEBUG)
            else:
                section = cargs.setdefault(part, {})
                if key in section:
                    section[key] = '%s\n%s' % (section[key], v)
                else:
                    section[key] = v
        else:
            pass
            # cargs[k] = v
    for k, v in cargs.items():
        args.setdefault(k, {}).update(v)

    overrides = {}
    if isinstance(args, type('')):
        for arg in args:
            section, keyvalue = arg.split(':', 1)
            key, value = keyvalue.split('=', 1)
            if isinstance(value, type([])):
                value = '\n'.join(value)
            overrides.setdefault('section', {})[key] = value
    else:
        overrides = args

    if options.showpipeline:
        for section, values in overrides.items():
            for key, value in values.items():
                cparser.set(section, key, value)
        cparser.write(sys.stdout)
        return

    # delay this so arg processing not so slow
    load_config("meta.zcml", Products.GenericSetup)
    load_config("configure.zcml", Products.GenericSetup)

    load_config('configure.zcml', mr.migrator)
    # Make sure GS ZCML is loaded before we load ours

    context = Context()
    transmogrifier = Transmogrifier(context)

    transmogrifier(pipelineid, **overrides)
Example #33
0
import sys

logging.basicConfig(level=logging.INFO)

try:
    import configparser
except ImportError:
    import ConfigParser as configparser
try:
    from Zope2.App.zcml import load_config
except:
    try:
        from Products.Five.zcml import load_config
    except:
        from zope.configuration.xmlconfig import XMLConfig as load_config
        load_config = lambda config, context: load_config(config, context)(
        )  # noqa


class Context:
    pass


class NoErrorParser(OptionParser):
    def error(self):
        pass


def runner(args={}, pipeline=None):

    parser = OptionParser()
Example #34
0
 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)
Example #35
0
    def setUp(cls):
        import Products.Five
        import Products.GenericSetup
        import Products.CMFCore
        import Products.CMFCore.exportimport
        import Products.DCWorkflow

        zcml.load_config('meta.zcml', Products.Five)
        zcml.load_config('meta.zcml', Products.GenericSetup)
        zcml.load_config('configure.zcml', Products.Five)
        zcml.load_config('configure.zcml', Products.GenericSetup)
        zcml.load_config('tool.zcml', Products.CMFCore)
        zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
        zcml.load_config('tool.zcml', Products.DCWorkflow)
        zcml.load_config('exportimport.zcml', Products.DCWorkflow)
        zcml.load_string(_DUMMY_ZCML)
Example #36
0
    def setUp(cls):
        import Zope2.App
        import AccessControl
        import Products.Five
        import Products.GenericSetup
        import zope.traversing

        # BBB for Zope 2.12
        try:
            from Zope2.App import zcml
        except ImportError:
            from Products.Five import zcml

        try:
            zcml.load_config('meta.zcml', Zope2.App)
        except IOError:  # Zope <= 2.12.x
            pass

        zcml.load_config('meta.zcml', Products.Five)
        zcml.load_config('meta.zcml', Products.GenericSetup)

        try:
            zcml.load_config('permissions.zcml', AccessControl)
        except IOError:  # Zope <= 2.12.x
            pass

        zcml.load_config('configure.zcml', zope.traversing)

        zcml.load_config('permissions.zcml', Products.Five)

        zcml.load_config('configure.zcml', Products.GenericSetup)
Example #37
0
# -*- 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)
Example #38
0
 def afterSetUp(self):
     zcml.load_config('meta.zcml', plone.session)
     zcml.load_config('configure.zcml', plone.session)
     zcml.load_config('configure.zcml', plone.session.tests)
     self.folder._setObject("pas", FakePAS("pas"))
     self.folder.pas._setObject("session", SessionPlugin("session"))
Example #39
0
 def setUp(self):
     import Products.GenericSetup
     zcml.load_config('meta.zcml', Products.GenericSetup)
Example #40
0
 def afterSetUp(self):
     from Products import LinguaPlone
     zcml.load_config('configure.zcml', LinguaPlone)
     installProduct('LinguaPlone', quiet=True)
     self.addProfile('LinguaPlone:default')
 def afterSetUp(self):
     from Zope2.App import zcml
     import Products.PageTemplates
     zcml.load_config("configure.zcml", Products.PageTemplates)
Example #42
0
    def testSetUp(cls):
        import Zope2.App
        import AccessControl
        import Products.Five
        import Products.GenericSetup
        import Products.CMFCore
        import Products.CMFCore.exportimport

        zcml.load_config('meta.zcml', Zope2.App)
        zcml.load_config('meta.zcml', Products.Five)
        zcml.load_config('permissions.zcml', AccessControl)
        zcml.load_config('permissions.zcml', Products.Five)
        zcml.load_config('meta.zcml', Products.GenericSetup)
        zcml.load_config('configure.zcml', Products.GenericSetup)
        zcml.load_config('permissions.zcml', Products.CMFCore)
        zcml.load_config('tool.zcml', Products.CMFCore)
        zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
        zcml.load_string(_DUMMY_ZCML)
        setHooks()
Example #43
0
    def setUp(cls):
        '''Sets up the CA.'''
        import Products.CMFDefault
        zcml.load_config('configure.zcml', Products.CMFDefault)

        import Products.CMFCalendar
        zcml.load_config('configure.zcml', Products.CMFCalendar)

        import Products.DCWorkflow
        zcml.load_config('configure.zcml', Products.DCWorkflow)

        import Products.Archetypes
        zcml.load_config('configure.zcml', Products.Archetypes)

        import Products.PlacelessTranslationService
        zcml.load_config('configure.zcml',
                         Products.PlacelessTranslationService)

        import plone.uuid
        zcml.load_config('configure.zcml', plone.uuid)
Example #44
0
 def testSetUp(cls):
     import plone.formwidget.autocomplete
     zcml.load_config('testing.zcml', plone.formwidget.autocomplete)
Example #45
0
# -*- coding: utf-8 -*-

# Add these early to avoid spurious ConfigurationErrors

try:
    eval("1 if True else 2")  # http://stackoverflow.com/questions/446052
    from Zope2.App.zcml import load_config
    import Products.Five
    load_config("configure.zcml", Products.Five)
    import Products.GenericSetup
    load_config("meta.zcml", Products.GenericSetup)
    load_config("configure.zcml", Products.GenericSetup)
except SyntaxError:
    # doesn't have ternary
    pass
Example #46
0
def setup():
    import pmr2.users
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', pmr2.users)
    fiveconfigure.debug_mode = False
Example #47
0
def load_zcml_of_testing_profile():
    fiveconfigure.debug_mode = True
    zcml.load_config('testing.zcml', package=Products.remember)
    fiveconfigure.debug_mode = False
Example #48
0
 def setUp(self):
     import Products.LDAPUserFolder
     super(LDAPUserFolderXMLAdapterTests, self).setUp()
     zcml.load_config('configure.zcml', Products.LDAPUserFolder)
     self._obj = LDAPUserFolder()
     self._BODY = _LDAPUSERFOLDER_BODY
Example #49
0
    def setUp(cls):
        import Products

        zcml.load_config('testing.zcml', Products.CMFCore)
        setHooks()
Example #50
0
 def setUp(self):
     super().setUp()
     component_setUp()
     zcml.load_config('meta.zcml', Products.Five)
     zcml.load_config('permissions.zcml', AccessControl)
     zcml.load_config('configure.zcml', Products.Five.utilities)