Example #1
0
    def setUp(self):
        # Stack a new DemoStorage on top of the one from z2.STARTUP.
        self['zodbDB'] = zodb.stackDemoStorage(self.get('zodbDB'),
                                               name='PloneSubRequestFixture')

        # Create a new global registry
        zca.pushGlobalRegistry()
        self['configurationContext'] = context = zca.stackConfigurationContext(
            self.get('configurationContext'))

        # Load out ZCML
        from zope.configuration import xmlconfig
        import plone.subrequest
        xmlconfig.file('testing.zcml', plone.subrequest, context=context)

        with z2.zopeApp() as app:
            # Enable virtual hosting
            z2.installProduct(app, 'Products.SiteAccess')
            from Products.SiteAccess.VirtualHostMonster import \
                VirtualHostMonster
            vhm = VirtualHostMonster()
            app._setObject(vhm.getId(), vhm, suppress_events=True)
            # With suppress_events=False, this is called twice...
            vhm.manage_afterAdd(vhm, app)
            # Setup default content
            app.manage_addFolder('folder1')
            make_site(app.folder1)
            app.folder1.manage_addFolder('folder1A')
            app.folder1.folder1A.manage_addFolder('folder1Ai')
            app.folder1.manage_addFolder('folder1B')
            app.manage_addFolder('folder2')
            make_site(app.folder2)
            app.folder2.manage_addFolder('folder2A')
            app.folder2.folder2A.manage_addFolder('folder2Ai space')
Example #2
0
    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)
Example #3
0
 def setUp(self):
     self['zodbDB'] = zodb.stackDemoStorage(self.get('zodbDB'),
                                            name=self.__name__)
     name = self.__name__ if self.__name__ is not None else 'not-named'
     contextName = "PloneSandboxLayer-%s" % name
     self['configurationContext'] = configurationContext = (
         zca.stackConfigurationContext(self.get('configurationContext'),
                                       name=contextName))
     # call ploneSite() for all pages in dict.
     plone_site_ids = [PLONE_SITE_ID]
     plone_site_ids.extend(additional_page['page_id']
                           for additional_page in ADDITIONAL_PAGES_TO_SETUP)
     for plone_site_id in plone_site_ids:
         with self.ploneSite(plone_site_id) as portal:
             from zope.site.hooks import setSite, setHooks
             setHooks()
             setSite(None)
             pushGlobalRegistry(portal)
             security.pushCheckers()
             from Products.PluggableAuthService.PluggableAuthService import (
                 MultiPlugins)
             preSetupMultiPlugins = MultiPlugins[:]
             self.setUpZope(portal.getPhysicalRoot(), configurationContext)
             setSite(portal)
             self.setUpPloneSite(portal)
             setSite(None)
         self.snapshotMultiPlugins(preSetupMultiPlugins)
Example #4
0
    def setUpZCML(self):
        """Load the basic ZCML configuration from Five. Exposes a resource
        ``configurationContext`` which can be used to load further ZCML.
        """

        # Push a new global registry so that we can cleanly tear down all ZCML
        from plone.testing import zca
        zca.pushGlobalRegistry()

        # Load something akin to the default site.zcml without actually auto-
        # loading products

        self['configurationContext'] = context = zca.stackConfigurationContext(self.get('configurationContext'))

        from zope.configuration import xmlconfig
        xmlconfig.string("""\
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:meta="http://namespaces.zope.org/meta">

    <include package="Products.Five" />
    <meta:redefinePermission from="zope2.Public" to="zope.Public" />

    <securityPolicy component="Products.Five.security.FiveSecurityPolicy" />

</configure>
""", context=context)
Example #5
0
    def setUpZCML(self):
        """Stack a new global registry and load ZCML configuration of Plone
        and the core set of add-on products into it. 
        """
        # Create a new global registry
        zca.pushGlobalRegistry()

        from zope.configuration import xmlconfig
        self['configurationContext'] = context = zca.stackConfigurationContext(
                                               self.get('configurationContext'))

        # Load dependent products's ZCML
        from zope.dottedname.resolve import resolve

        def loadAll(filename):
            for p, config in self.products:
                if not config['loadZCML']:
                    continue
                try:
                    package = resolve(p)
                except ImportError:
                    continue
                try:
                    xmlconfig.file(filename, package, context=context)
                except IOError:
                    pass

        loadAll('meta.zcml')
        loadAll('configure.zcml')
        loadAll('overrides.zcml')
        provideAdapter(ldapprops)
        provideAdapter(usersconfig)
        provideAdapter(groupsconfig)
        provideUtility(self['app'], provides=ISiteRoot)
Example #6
0
    def setUpZCML(self):
        """Stack a new global registry and load ZCML configuration of
        CMFDefault and the core set of add-on products into it.
        """

        # Create a new global registry
        zca.pushGlobalRegistry()

        from zope.configuration import xmlconfig
        self['configurationContext'] = context = zca.stackConfigurationContext(
            self.get('configurationContext'))

        # Load dependent products's ZCML
        # CMFDefault doesn't specify dependencies on Products.* packages fully
        from zope.dottedname.resolve import resolve

        def loadAll(filename):
            for p, config in self.products:
                if not config['loadZCML']:
                    continue
                try:
                    package = resolve(p)
                except ImportError:
                    continue
                try:
                    xmlconfig.file(filename, package, context=context)
                except IOError:
                    pass

        loadAll('meta.zcml')
        loadAll('configure.zcml')
        loadAll('overrides.zcml')
    def setUp(self):
        self['configurationContext'] = zca.stackConfigurationContext(
            self.get('configurationContext'))

        import ftwbook.graphicblock.tests
        xmlconfig.file('tests.zcml', ftwbook.graphicblock.tests,
                       context=self['configurationContext'])
Example #8
0
    def testSetUp(self):
        import ftw.book.tests
        self['configurationContext'] = zca.stackConfigurationContext(
            self.get('configurationContext'))

        xmlconfig.file('latex.zcml', ftw.book.tests,
                       context=self['configurationContext'])
Example #9
0
    def setUpZCML(self):
        """Load the basic ZCML configuration from Five. Exposes a resource
        ``configurationContext`` which can be used to load further ZCML.
        """

        # Push a new global registry so that we can cleanly tear down all ZCML
        from plone.testing import zca
        zca.pushGlobalRegistry()

        # Load something akin to the default site.zcml without actually auto-
        # loading products

        self['configurationContext'] = context = zca.stackConfigurationContext(
            self.get('configurationContext'))

        from zope.configuration import xmlconfig
        xmlconfig.string("""\
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:meta="http://namespaces.zope.org/meta">

    <include package="Products.Five" />
    <meta:redefinePermission from="zope2.Public" to="zope.Public" />

    <securityPolicy component="Products.Five.security.FiveSecurityPolicy" />

</configure>
""",
                         context=context)
Example #10
0
 def setUp(self):
     self['configurationContext'] = context = \
         zca.stackConfigurationContext(self.get('configurationContext'))
     import plone.z3cform
     xmlconfig.file('testing.zcml', plone.z3cform, context=context)
     import z3c.form
     xmlconfig.file('configure.zcml', z3c.form, context=context)
Example #11
0
    def setUp(self):
        # Stack a new DemoStorage on top of the one from z2.STARTUP.
        self["zodbDB"] = zodb.stackDemoStorage(self.get("zodbDB"), name="PloneSubRequestFixture")

        # Create a new global registry
        zca.pushGlobalRegistry()
        self["configurationContext"] = context = zca.stackConfigurationContext(self.get("configurationContext"))

        # Load out ZCML
        from zope.configuration import xmlconfig
        import plone.subrequest

        xmlconfig.file("testing.zcml", plone.subrequest, context=context)

        with z2.zopeApp() as app:
            # Enable virtual hosting
            z2.installProduct(app, "Products.SiteAccess")
            from Products.SiteAccess.VirtualHostMonster import VirtualHostMonster

            vhm = VirtualHostMonster()
            app._setObject(vhm.getId(), vhm, suppress_events=True)
            # With suppress_events=False, this is called twice...
            vhm.manage_afterAdd(vhm, app)
            # Setup default content
            app.manage_addFolder("folder1")
            make_site(app.folder1)
            app.folder1.manage_addFolder("folder1A")
            app.folder1.folder1A.manage_addFolder("folder1Ai")
            app.folder1.manage_addFolder("folder1B")
            app.manage_addFolder("folder2")
            make_site(app.folder2)
            app.folder2.manage_addFolder("folder2A")
            app.folder2.folder2A.manage_addFolder("folder2Ai space")
Example #12
0
 def setUp(self):
     self['configurationContext'] = context = zca.stackConfigurationContext(
         self.get('configurationContext'))
     import ploneintranet.microblog
     xmlconfig.file(self.zcml_file,
                    ploneintranet.microblog,
                    context=context)
Example #13
0
    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)
Example #14
0
 def setUp(self):
     self['configurationContext'] = context = zca.stackConfigurationContext(
         self.get('configurationContext')
     )
     import zope.annotation
     xmlconfig.file('configure.zcml', zope.annotation, context=context)
     import plone.tiles
     xmlconfig.file('configure.zcml', plone.tiles, context=context)
Example #15
0
    def testSetUp(self):
        import ftw.book.tests
        self['configurationContext'] = zca.stackConfigurationContext(
            self.get('configurationContext'))

        xmlconfig.file('latex.zcml',
                       ftw.book.tests,
                       context=self['configurationContext'])
Example #16
0
    def setUp(self):
        # Stack a new configuration context
        self['configurationContext'] = context = zca.stackConfigurationContext(
            self.get('configurationContext'))

        import Products.Five
        import five.customerize
        xmlconfig.file('configure.zcml', Products.Five, context=context)
        xmlconfig.file('configure.zcml', five.customerize, context=context)
Example #17
0
 def setUp(self):
     self['configurationContext'] = context = zca.stackConfigurationContext(
         self.get('configurationContext')
     )
     import ploneintranet.microblog
     xmlconfig.file(
         self.zcml_file,
         ploneintranet.microblog,
         context=context
     )
Example #18
0
    def setUp(self):
        self["configurationContext"] = context = stackConfigurationContext(self.get("configurationContext"))

        import ftw.dictstorage

        xmlconfig.file("configure.zcml", ftw.dictstorage, context=context)

        class ExampleContext(object):
            pass

        self["example_context"] = ExampleContext()
Example #19
0
    def setUp(self):
        # Stack the component registry
        self['configurationContext'] = zca.stackConfigurationContext(
            self.get('configurationContext'))

        # Stack the database
        self['zodbDB'] = zodb.stackDemoStorage(
            self.get('zodbDB'), name='SimplelayoutTopicsLayer')

        with ploneSite() as portal:
            applyProfile(portal, 'ftw.topics.tests:example')
Example #20
0
    def setUpZCML(self):
        """Include imio.dms.mail i18n locales before Plone to override plone messages."""
        pr = list(self.products)
        pr.insert(-2, ('imio.dms.mail', {
            'loadZCML': True,
            'load_only': {
                'configure.zcml': 'testing_locales.zcml'
            }
        }))
        self.products = tuple(pr)

        # Create a new global registry
        zca.pushGlobalRegistry()

        from zope.configuration import xmlconfig
        self['configurationContext'] = context = zca.stackConfigurationContext(
            self.get('configurationContext'))

        # Turn off z3c.autoinclude
        xmlconfig.string("""\
<configure xmlns="http://namespaces.zope.org/zope" xmlns:meta="http://namespaces.zope.org/meta">
    <meta:provides feature="disable-autoinclude" />
</configure>
""",
                         context=context)

        from zope.dottedname.resolve import resolve

        def loadAll(filename):
            for p, config in self.products:
                if not config['loadZCML']:
                    continue
                # we don't want to load overrides.zcml now !
                if 'load_only' in config and filename not in config[
                        'load_only']:
                    continue
                try:
                    package = resolve(p)
                except ImportError:
                    continue
                try:
                    if 'load_only' in config and filename in config[
                            'load_only']:
                        xmlconfig.file(config['load_only'][filename],
                                       package,
                                       context=context)
                    else:
                        xmlconfig.file(filename, package, context=context)
                except IOError:
                    pass

        loadAll('meta.zcml')
        loadAll('configure.zcml')
        loadAll('overrides.zcml')
Example #21
0
    def setUp(self):
        # Push a new configuration context so that it's possible to re-import
        # ZCML files after tear-down (in Plone tests, PloneSandboxLayer does
        # this for you)
        self['configurationContext'] = configurationContext = (
            zca.stackConfigurationContext(self['configurationContext'],
            name='ZAMQP-Testing'))
        zca.pushGlobalRegistry()

        xmlconfig.file('testing.zcml', collective.zamqp,
                       context=self['configurationContext'])
 def setUp(self):
     BeakerConfigLayer.setUp()
     
     zca.pushGlobalRegistry()
     self['configurationContext'] = context = zca.stackConfigurationContext(self.get('configurationContext'))
     import collective.confirm_email
     xmlconfig.file('configure.zcml', package=collective.confirm_email, context=context)
     
     from collective.confirm_email.nonce import NonceManager
     from collective.confirm_email.interfaces import INonceManager
     provideUtility(NonceManager(), provides=INonceManager)
     provideUtility(MockMailHost('MailHost'), provides=IMailHost)
Example #23
0
    def setUp(self):
        try:
            # Push a new database storage so that database changes
            # commited during layer setup can be easily torn down
            self['zodbDB'] = zodb.stackDemoStorage(self.get('zodbDB'),
                                                   name=self.__name__)

            # Push a new configuration context so that it's possible to
            # re-import ZCML files after tear-down
            name = self.__name__ if self.__name__ is not None else 'not-named'
            contextName = 'PloneSandboxLayer-{0}'.format(name)
            self['configurationContext'] = configurationContext = (
                zca.stackConfigurationContext(self.get('configurationContext'),
                                              name=contextName))

            with ploneSite() as portal:
                setHooks()

                # Make sure there's no local site manager while we load ZCML
                setSite(None)

                # Push a new component registry so that ZCML registations
                # and other global component registry changes are sandboxed
                pushGlobalRegistry(portal)

                # Persist GenericSetup profile upgrade versions for easy
                # rollback.
                persist_profile_upgrade_versions(portal)

                # Make sure zope.security checkers can be set up and torn down
                # reliably

                security.pushCheckers()

                from Products.PluggableAuthService.PluggableAuthService import MultiPlugins  # noqa

                preSetupMultiPlugins = MultiPlugins[:]

                # Allow subclass to load ZCML and products
                self.setUpZope(portal.getPhysicalRoot(), configurationContext)

                # Allow subclass to configure a persistent fixture
                setSite(portal)
                self.setUpPloneSite(portal)
                setSite(None)

            # Keep track of PAS plugins that were added during setup
            self.snapshotMultiPlugins(preSetupMultiPlugins)
        except Exception:
            del self['configurationContext']
            self['zodbDB'].close()
            del self['zodbDB']
            raise
Example #24
0
    def testSetUp(self):
        self['configurationContext'] = zca.stackConfigurationContext(
            self.get('configurationContext'))

        import ftw.tooltip.tests
        xmlconfig.file('tests.zcml',
                       ftw.tooltip.tests,
                       context=self['configurationContext'])
        import ftw.tooltip.browser
        xmlconfig.file('configure.zcml',
                       ftw.tooltip.browser,
                       context=self['configurationContext'])
Example #25
0
    def setUp(self):
        try:
            # Push a new database storage so that database changes
            # commited during layer setup can be easily torn down
            self['zodbDB'] = zodb.stackDemoStorage(self.get('zodbDB'),
                    name=self.__name__)

            # Push a new configuration context so that it's possible to re-import
            # ZCML files after tear-down
            name = self.__name__ if self.__name__ is not None else 'not-named'
            contextName = "PloneSandboxLayer-%s" % name
            self['configurationContext'] = configurationContext = (
                zca.stackConfigurationContext(self.get('configurationContext'),
                name=contextName))

            with ploneSite() as portal:

                from zope.site.hooks import setSite, setHooks
                setHooks()

                # Make sure there's no local site manager while we load ZCML
                setSite(None)

                # Push a new component registry so that ZCML registations
                # and other global component registry changes are sandboxed
                pushGlobalRegistry(portal)

                # Make sure zope.security checkers can be set up and torn down
                # reliably

                security.pushCheckers()

                from Products.PluggableAuthService.PluggableAuthService import (
                        MultiPlugins)

                preSetupMultiPlugins = MultiPlugins[:]

                # Allow subclass to load ZCML and products
                self.setUpZope(portal.getPhysicalRoot(), configurationContext)

                # Allow subclass to configure a persistent fixture
                setSite(portal)
                self.setUpPloneSite(portal)
                setSite(None)

            # Keep track of PAS plugins that were added during setup
            self.snapshotMultiPlugins(preSetupMultiPlugins)
        except:
            del self['configurationContext']
            self['zodbDB'].close()
            del self['zodbDB']
            raise
Example #26
0
    def setUp(self):
        from zope.configuration import xmlconfig

        # Stack a new configuration context
        self['configurationContext'] = context = zca.stackConfigurationContext(self.get('configurationContext'))

        import zope.security
        xmlconfig.file('meta.zcml', zope.security, context=context)

        # XXX: In Zope 2.13, this has split into zope.publisher,
        # zope.browserresource, zope.browsermenu and zope.browserpage
        import zope.app.publisher
        xmlconfig.file('meta.zcml', zope.app.publisher, context=context)
Example #27
0
    def setUp(self):
        zca.pushGlobalRegistry()
        self.configurationContext = zca.stackConfigurationContext()

        import ftw.inflator
        xmlconfig.file('meta.zcml', ftw.inflator, context=self.configurationContext)

        with zopeApp() as app:
            self.app = app

            self.browser = Browser(app)
            self.browser.handleErrors = False
            self.browser.addHeader('Authorization', 'Basic %s:%s' % (
                    SITE_OWNER_NAME, SITE_OWNER_PASSWORD))
Example #28
0
    def testSetUp(self):
        self['configurationContext'] = context = \
            zca.stackConfigurationContext(self.get('configurationContext'))

        import zope.annotation
        xmlconfig.file(
            'configure.zcml', zope.annotation, context=context)

        import zope.traversing
        xmlconfig.file(
            'configure.zcml', zope.traversing, context=context)

        import ftw.poodle
        xmlconfig.file(
            'tests.zcml', ftw.poodle, context=context)
Example #29
0
    def setUpZCML(self):
        """Stack a new global registry and load ZCML configuration of Plone
        and the core set of add-on products into it. Also set the
        ``disable-autoinclude`` ZCML feature so that Plone does not attempt to
        auto-load ZCML using ``z3c.autoinclude``.
        """

        # Create a new global registry
        zca.pushGlobalRegistry()

        from zope.configuration import xmlconfig

        self["configurationContext"] = context = zca.stackConfigurationContext(self.get("configurationContext"))

        # Turn off z3c.autoinclude

        xmlconfig.string(
            """\
<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:meta="http://namespaces.zope.org/meta">
    <meta:provides feature="disable-autoinclude" />
</configure>
""",
            context=context,
        )

        # Load dependent products's ZCML - Plone doesn't specify dependencies
        # on Products.* packages fully

        from zope.dottedname.resolve import resolve

        def loadAll(filename):
            for p, config in self.products:
                if not config["loadZCML"]:
                    continue
                try:
                    package = resolve(p)
                except ImportError:
                    continue
                try:
                    xmlconfig.file(filename, package, context=context)
                except IOError:
                    pass

        loadAll("meta.zcml")
        loadAll("configure.zcml")
        loadAll("overrides.zcml")
Example #30
0
    def setUp(self):
        zca.pushGlobalRegistry()
        self.configurationContext = zca.stackConfigurationContext()

        import ftw.inflator
        xmlconfig.file('meta.zcml',
                       ftw.inflator,
                       context=self.configurationContext)

        with zopeApp() as app:
            self.app = app

            self.browser = Browser(app)
            self.browser.handleErrors = False
            self.browser.addHeader(
                'Authorization',
                'Basic %s:%s' % (SITE_OWNER_NAME, SITE_OWNER_PASSWORD))
Example #31
0
    def testSetUp(self):
        self["configurationContext"] = zca.stackConfigurationContext(self.get("configurationContext"))

        import zope.traversing

        xmlconfig.file("configure.zcml", zope.traversing, context=self["configurationContext"])

        import ftw.pdfgenerator.tests

        xmlconfig.file("test.zcml", ftw.pdfgenerator.tests, context=self["configurationContext"])

        import ftw.pdfgenerator

        xmlconfig.file("configure.zcml", ftw.pdfgenerator, context=self["configurationContext"])

        import ftw.meeting.latex

        xmlconfig.file("configure.zcml", ftw.meeting.latex, context=self["configurationContext"])
Example #32
0
    def setUp(self):
        from zope.configuration import xmlconfig

        # Stack a new configuration context
        self['configurationContext'] = context = zca.stackConfigurationContext(
            self.get('configurationContext'))

        import zope.security
        xmlconfig.file('meta.zcml', zope.security, context=context)

        import zope.browsermenu
        xmlconfig.file('meta.zcml', zope.browsermenu, context=context)
        import zope.browserpage
        xmlconfig.file('meta.zcml', zope.browserpage, context=context)
        import zope.browserresource
        xmlconfig.file('meta.zcml', zope.browserresource, context=context)
        import zope.publisher
        xmlconfig.file('meta.zcml', zope.publisher, context=context)
Example #33
0
    def setUp(self):
        from zope.configuration import xmlconfig

        # Stack a new configuration context
        self['configurationContext'] = context = zca.stackConfigurationContext(
            self.get('configurationContext'))

        import zope.security
        xmlconfig.file('meta.zcml', zope.security, context=context)

        import zope.browsermenu
        xmlconfig.file('meta.zcml', zope.browsermenu, context=context)
        import zope.browserpage
        xmlconfig.file('meta.zcml', zope.browserpage, context=context)
        import zope.browserresource
        xmlconfig.file('meta.zcml', zope.browserresource, context=context)
        import zope.publisher
        xmlconfig.file('meta.zcml', zope.publisher, context=context)
    def setUp(self):
        self['configurationContext'] = zca.stackConfigurationContext(
            self.get('configurationContext'))

        zca.pushGlobalRegistry()

        import collective.ploneupgradecheck
        self.load_zcml_file('configure.zcml', collective.ploneupgradecheck)

        self.my_package_path = os.path.join(os.path.dirname(__file__),
                                            'tests', 'my.package')

        file_registry = getUtility(IFileRegistry)
        file_registry.clear()
        file_registry.load(self.my_package_path)

        import_registry = getUtility(IImportRegistry)
        import_registry.clear()
Example #35
0
    def setUpZCML(self):
        """Stack a new global registry and load ZCML configuration of Plone
        and the core set of add-on products into it. Also set the
        ``disable-autoinclude`` ZCML feature so that Plone does not attempt to
        auto-load ZCML using ``z3c.autoinclude``.
        """

        # Create a new global registry
        zca.pushGlobalRegistry()

        from zope.configuration import xmlconfig
        self['configurationContext'] = context = zca.stackConfigurationContext(
            self.get('configurationContext'))

        # Turn off z3c.autoinclude

        xmlconfig.string("""\
<configure xmlns="http://namespaces.zope.org/zope" xmlns:meta="http://namespaces.zope.org/meta">
    <meta:provides feature="disable-autoinclude" />
</configure>
""",
                         context=context)

        # Load dependent products's ZCML - Plone doesn't specify dependencies
        # on Products.* packages fully

        from zope.dottedname.resolve import resolve

        def loadAll(filename):
            for p, config in self.products:
                if not config['loadZCML']:
                    continue
                try:
                    package = resolve(p)
                except ImportError:
                    continue
                try:
                    xmlconfig.file(filename, package, context=context)
                except IOError:
                    pass

        loadAll('meta.zcml')
        loadAll('configure.zcml')
        loadAll('overrides.zcml')
Example #36
0
    def testSetUp(self):
        self['configurationContext'] = zca.stackConfigurationContext(
            self.get('configurationContext'))

        import zope.traversing
        xmlconfig.file('configure.zcml', zope.traversing,
                       context=self['configurationContext'])

        import ftw.pdfgenerator.tests
        xmlconfig.file('test.zcml', ftw.pdfgenerator.tests,
                       context=self['configurationContext'])

        import ftw.pdfgenerator
        xmlconfig.file('configure.zcml', ftw.pdfgenerator,
                       context=self['configurationContext'])

        import ftw.blog.latex
        xmlconfig.file('configure.zcml', ftw.blog.latex,
                       context=self['configurationContext'])
Example #37
0
    def setUp(self):
        # Stack the component registry
        self["configurationContext"] = zca.stackConfigurationContext(self.get("configurationContext"))

        # Stack the database
        self["zodbDB"] = zodb.stackDemoStorage(self.get("zodbDB"), name="ftw.book:examplecontent")

        # Register and apply the example content GS profile
        import ftw.book.tests

        xmlconfig.file("examplecontent.zcml", ftw.book.tests, context=self["configurationContext"])

        with ploneSite() as portal:
            request = portal.REQUEST
            mark_layer(None, Dummy(request=request))
            provide_request_layer(request, IWithinBookLayer)
            provide_request_layer(request, IDefaultBookLayoutSelectionLayer)

            applyProfile(portal, "ftw.book.tests:examplecontent")
    def test_adding_class_declaration(self):
        # Create a new global registry
        zca.pushGlobalRegistry()

        from zope.configuration import xmlconfig
        self.layer['configurationContext'] = context = zca.stackConfigurationContext(self.layer.get('configurationContext'))
        xmlconfig.string("""\
            <configure
                xmlns="http://namespaces.zope.org/zope"
                xmlns:diversion="http://namespaces.plone.org/diversion">
                
                <diversion:class
                    old="Products.example.oldlocation"
                    new="collective.example.shiny"
                    />

            </configure>
            
        """, context=context)
        self.assertEqual(diversion.diversions['Products.example', 'oldlocation'], ('collective.example', 'shiny'))
Example #39
0
    def setUp(self):
        # Stack the component registry
        self['configurationContext'] = zca.stackConfigurationContext(
            self.get('configurationContext'))

        # Stack the database
        self['zodbDB'] = zodb.stackDemoStorage(self.get('zodbDB'),
                                               name='ftw.book:examplecontent')

        # Register and apply the example content GS profile
        import ftw.book.tests
        xmlconfig.file('examplecontent.zcml',
                       ftw.book.tests,
                       context=self['configurationContext'])

        with ploneSite() as portal:
            request = portal.REQUEST
            mark_layer(None, Dummy(request=request))
            provide_request_layer(request, IWithinBookLayer)
            provide_request_layer(request, IDefaultBookLayoutSelectionLayer)

            applyProfile(portal, 'ftw.book.tests:examplecontent')
Example #40
0
    def setUp(self):

        # Push a new database storage so that database changes
        # commited during layer setup can be easily torn down
        self['zodbDB'] = zodb.stackDemoStorage(
            self.get('zodbDB'), name=self.__name__
        )

        # Push a new configuration context so that it's possible to re-import
        # ZCML files after tear-down
        if self.__name__ is not None:
            name = self.__name__
        else:
            name = 'not-named'
        contextName = "SilvaSandboxLayer-%s" % name
        self['configurationContext'] = configurationContext = (
            zca.stackConfigurationContext(
                self.get('configurationContext'),
                name=contextName
            )
        )

        for silvaroot in silvaRoot():
            from zope.app.component.hooks import setHooks
            setHooks()

            # Push a new component registry so that ZCML registations
            # and other global component registry changes are sandboxed
            pushGlobalRegistry(silvaroot)

            # Make sure zope.security checkers can be set up and torn down
            # reliably

            security.pushCheckers()

            # Allow subclass to load ZCML and products
            self.setUpZope(silvaroot.getPhysicalRoot(), configurationContext)

            self.setUpSilvaSite(silvaroot)
Example #41
0
    def testSetUp(self):
        self['configurationContext'] = zca.stackConfigurationContext(
            self.get('configurationContext'))

        import zope.traversing
        xmlconfig.file('configure.zcml',
                       zope.traversing,
                       context=self['configurationContext'])

        import ftw.pdfgenerator.tests
        xmlconfig.file('test.zcml',
                       ftw.pdfgenerator.tests,
                       context=self['configurationContext'])

        import ftw.pdfgenerator
        xmlconfig.file('configure.zcml',
                       ftw.pdfgenerator,
                       context=self['configurationContext'])

        import ftw.blog.latex
        xmlconfig.file('configure.zcml',
                       ftw.blog.latex,
                       context=self['configurationContext'])
Example #42
0
    def setUp(self):
        from zope.configuration import xmlconfig

        # Stack a new configuration context
        self['configurationContext'] = context = zca.stackConfigurationContext(
            self.get('configurationContext'))

        # D001 requests to use self.loadZCML instead of xmlconfig.file but
        # loadZCML is defined in `plone.app.testing` and cannot be used here.
        import zope.security
        xmlconfig.file(  # noqa: D001
            'meta.zcml', zope.security, context=context)
        import zope.browsermenu
        xmlconfig.file(  # noqa: D001
            'meta.zcml', zope.browsermenu, context=context)
        import zope.browserpage
        xmlconfig.file(  # noqa: D001
            'meta.zcml', zope.browserpage, context=context)
        import zope.browserresource
        xmlconfig.file(  # noqa: D001
            'meta.zcml', zope.browserresource, context=context)
        import zope.publisher
        xmlconfig.file(  # noqa: D001
            'meta.zcml', zope.publisher, context=context)
Example #43
0
    def setUp(self):
        self["configurationContext"] = context = zca.stackConfigurationContext(self.get("configurationContext"))
        import plonesocial.microblog

        xmlconfig.file(self.zcml_file, plonesocial.microblog, context=context)
Example #44
0
    def setUp(self):
        zca.pushGlobalRegistry()
        self.configurationContext = zca.stackConfigurationContext()

        import ftw.inflator
        xmlconfig.file('meta.zcml', ftw.inflator, context=self.configurationContext)
Example #45
0
 def _get_configuration_context(self):
     if self._configuration_context is None:
         self._configuration_context = zca.stackConfigurationContext(
             self.get('configurationContext'))
         self['configurationContext'] = self._configuration_context
     return self._configuration_context
Example #46
0
 def setUp(self):
     import plone.tiles
     self['configurationContext'] = context = zca.stackConfigurationContext(
         self.get('configurationContext')
     )
     xmlconfig.file('configure.zcml', plone.tiles, context=context)
Example #47
0
    def setUp(self):
        import plone.tiles

        self["configurationContext"] = context = zca.stackConfigurationContext(self.get("configurationContext"))
        xmlconfig.file("configure.zcml", plone.tiles, context=context)
Example #48
0
 def setUp(self):
     import plone.tiles
     self['configurationContext'] = context = zca.stackConfigurationContext(
         self.get('configurationContext'))
     xmlconfig.file('configure.zcml', plone.tiles, context=context)