コード例 #1
0
ファイル: helpers.py プロジェクト: gotcha/silva.testing
def silvaRoot(db=None, connection=None, environ=None):
    """Context manager for working with the Silva root during layer setup::

        with silvaRoot() as silvaroot:
            ...

    This is based on the ``z2.zopeApp()`` context manager. See the module
     ``plone.testing.z2`` for details.

    Do not use this in a test.
    Use the 'silvaroot' resource from the SilvaFixture layer instead!

    Pass a ZODB handle as ``db`` to use a specificdatabase. Alternatively,
    pass an open connection as ``connection`` (the connection will not be
    closed).
    """

    from zope.app.component.hooks import setHooks
    setHooks()

    for app in z2.zopeApp(db, connection, environ):
        silvaroot = app[SILVA_SITE_ID]

        login(silvaroot, SITE_OWNER_NAME)

        try:
            yield silvaroot
        # the finally is replaced by the pair except else
        # 2.4 does not accept yield in a try...finally
        except:
            logout()
        else:
            logout()
コード例 #2
0
ファイル: cmf_layers.py プロジェクト: jakke/plone.bbb_testing
def CMFDefaultPortal(db=None, connection=None, environ=None):
    """Context manager for working with the Plone portal during layer setup::

        with CMFDefaultPortal() as portal:
            ...

    This is based on the ``z2.zopeApp()`` context manager. See the module
     ``plone.testing.z2`` for details.

    Do not use this in a test. Use the 'portal' resource from the PloneFixture
    layer instead!

    Pass a ZODB handle as ``db`` to use a specificdatabase. Alternatively,
    pass an open connection as ``connection`` (the connection will not be
    closed).
    """

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

    site = getSite()

    with z2.zopeApp(db, connection, environ) as app:
        portal = app[SITE_ID]

        setSite(portal)
        z2.login(portal['acl_users'], TEST_USER_ID)

        try:
            yield portal
        finally:
            z2.logout()
            if site is not portal:
                setSite(site)
コード例 #3
0
ファイル: helpers.py プロジェクト: gotcha/silva.testing
    def tearDown(self):

        for app in z2.zopeApp():

            silvaroot = app[SILVA_SITE_ID]

            from zope.app.component.hooks import setHooks
            setHooks()

            # Allow subclass to tear down persistent fixture
            self.tearDownSilvaSite(silvaroot)

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

            security.popCheckers()

            # Pop the component registry, thus removing component
            # architecture registrations
            popGlobalRegistry(silvaroot)

            # Allow subclass to tear down products
            self.tearDownZope(app)

        # Zap the configuration context
        del self['configurationContext']

        # Pop the demo storage, thus restoring the database to the
        # previous state
        self['zodbDB'].close()
        del self['zodbDB']
コード例 #4
0
def ploneSite(db=None, connection=None, environ=None):
    """Context manager for working with the Plone portal during layer setup::

        with ploneSite() as portal:
            ...

    This is based on the ``z2.zopeApp()`` context manager. See the module
     ``plone.testing.z2`` for details.

    Do not use this in a test. Use the 'portal' resource from the PloneFixture
    layer instead!

    Pass a ZODB handle as ``db`` to use a specificdatabase. Alternatively,
    pass an open connection as ``connection`` (the connection will not be
    closed).
    """

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

    site = getSite()

    with z2.zopeApp(db, connection, environ) as app:
        portal = app[PLONE_SITE_ID]

        setSite(portal)
        login(portal, TEST_USER_NAME)

        try:
            yield portal
        finally:
            logout()
            if site is not portal:
                setSite(site)
コード例 #5
0
    def tearDown(self):

        with z2.zopeApp() as app:

            portal = app[PLONE_SITE_ID]
            setHooks()
            setSite(portal)

            # Allow subclass to tear down persistent fixture
            self.tearDownPloneSite(portal)

            setSite(None)

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

            security.popCheckers()

            # Pop the component registry, thus removing component
            # architecture registrations
            popGlobalRegistry(portal)

            # Remove PAS plugins
            self.tearDownMultiPlugins()

            # Allow subclass to tear down products
            self.tearDownZope(app)

        # Zap the configuration context
        del self['configurationContext']

        # Pop the demo storage, thus restoring the database to the
        # previous state
        self['zodbDB'].close()
        del self['zodbDB']
コード例 #6
0
    def setUpContent(self):
        import plone.app.linkintegrity

        xmlconfig.file("configure.zcml", plone.app.linkintegrity, context=self["configurationContext"])

        with z2.zopeApp() as app:
            z2.installProduct(app, "plone.app.linkintegrity")

        with ploneSite() as portal:
            setRoles(portal, TEST_USER_ID, ["Manager"])
            login(portal, TEST_USER_NAME)

            # Create sample documents
            type_data = dict(type_name="Document")
            for i in range(1, 4):
                type_data["id"] = "doc{0:d}".format(i)
                type_data["title"] = "Test Page {0:d}".format(i)
                create(portal, **type_data)

            create(portal, "File", id="file1", title="File 1", file=GIF)
            create(portal, "Image", id="image1", title="Image 1", image=GIF)
            create(portal, "Folder", id="folder1", title="Folder 1")
            subfolder = portal["folder1"]
            create(subfolder, "Document", id="doc4", title="Test Page 4")

            self.setUpMembers(portal)
コード例 #7
0
ファイル: testing.py プロジェクト: urska19/Plone-test
    def setUpContent(self):
        import plone.app.linkintegrity

        xmlconfig.file('configure.zcml', plone.app.linkintegrity,
                       context=self['configurationContext'])

        with z2.zopeApp() as app:
            z2.installProduct(app, 'plone.app.linkintegrity')

        with ploneSite() as portal:
            setRoles(portal, TEST_USER_ID, ['Manager', ])
            login(portal, TEST_USER_NAME)

            # Create sample documents
            type_data = dict(type_name='Document')
            for i in range(1, 4):
                type_data['id'] = 'doc{0:d}'.format(i)
                type_data['title'] = 'Test Page {0:d}'.format(i)
                create(portal, **type_data)

            create(portal, 'File', id='file1', title='File 1', file=GIF)
            create(portal, 'Image', id='image1', title='Image 1', image=GIF)
            create(portal, 'Folder', id='folder1', title='Folder 1')
            subfolder = portal['folder1']
            create(subfolder, 'Document', id='doc4', title='Test Page 4')

            self.setUpMembers(portal)
コード例 #8
0
    def setUpContent(self):
        import plone.app.linkintegrity
        xmlconfig.file('configure.zcml',
                       plone.app.linkintegrity,
                       context=self['configurationContext'])

        with z2.zopeApp() as app:
            z2.installProduct(app, 'plone.app.linkintegrity')

        with ploneSite() as portal:
            setRoles(portal, TEST_USER_ID, [
                'Manager',
            ])
            login(portal, TEST_USER_NAME)

            # Create sample documents
            type_data = dict(type_name='Document')
            for i in range(1, 4):
                type_data['id'] = 'doc{0:d}'.format(i)
                type_data['title'] = 'Test Page {0:d}'.format(i)
                create(portal, **type_data)

            create(portal, 'File', id='file1', title='File 1', file=GIF)
            create(portal, 'Image', id='image1', title='Image 1', image=GIF)
            create(portal, 'Folder', id='folder1', title='Folder 1')
            subfolder = portal['folder1']
            create(subfolder, 'Document', id='doc4', title='Test Page 4')

            self.setUpMembers(portal)
コード例 #9
0
ファイル: testing.py プロジェクト: vedantc98/Plone-test
    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')
コード例 #10
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")
コード例 #11
0
 def setUpZope(self, app, configurationContext):
     # Load ZCML
     import Products.CMFContentPanels
     xmlconfig.file('configure.zcml',
                    Products.CMFContentPanels,
                    context=configurationContext)
     with z2.zopeApp() as app:
             z2.installProduct(app, 'Products.CMFContentPanels')
コード例 #12
0
    def setUp(self):
        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))
コード例 #13
0
    def setUp(self):
        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))
コード例 #14
0
 def tearDown(self):
     with z2.zopeApp() as app:
         portal = app[PLONE_SITE_ID]
         _o_mailhost = getattr(portal, "_original_MailHost", None)
         if _o_mailhost:
             portal.MailHost = portal._original_MailHost
             sm = getSiteManager(context=portal)
             sm.unregisterUtility(provided=IMailHost)
             sm.registerUtility(aq_base(portal._original_MailHost), provided=IMailHost)
コード例 #15
0
    def testTearDown(self):
        with z2.zopeApp() as app:
            # Clean up sessions after each test
            app.session_data_manager._p_jar.sync()
            app.session_data_manager._getSessionDataContainer()._reset()

            # Commit transaction
            from transaction import commit
            commit()
コード例 #16
0
ファイル: testing.py プロジェクト: treinhard/ftw.inflator
 def setUpDefaultContent(self, app):
     # do not create plone site
     with z2.zopeApp() as app:
         app['acl_users'].userFolderAddUser(
                 SITE_OWNER_NAME,
                 SITE_OWNER_PASSWORD,
                 ['Manager'],
                 []
             )
コード例 #17
0
 def setUp(self):
     with z2.zopeApp() as app:
         z2.installProduct(app, 'Products.PluggableAuthService')
         z2.installProduct(app, 'Products.NoDuplicateLogin')
         z2.installProduct(app, 'Products.PythonScripts')
         
         app.manage_addProduct['PythonScripts'].manage_addPythonScript("whoami")
         whoami = app.whoami
         whoami.write(WHOAMI_SCRIPT)
コード例 #18
0
    def testTearDown(self):
        with z2.zopeApp() as app:
            # Clean up sessions after each test
            app.session_data_manager._p_jar.sync()
            app.session_data_manager._getSessionDataContainer()._reset()

            # Commit transaction
            from transaction import commit
            commit()
コード例 #19
0
 def setUpZope(self, app, configuration_context):
     """Set up Zope for testing"""
     xmlconfig.file(
             'configure.zcml',
             Products.PloneBooking,
             context=configuration_context
     )
     with z2.zopeApp() as app:
         z2.installProduct(app, 'Products.PloneBooking')
コード例 #20
0
    def setUpZope(self, app, configurationContext):
        from plone.testing import z2

        with z2.zopeApp() as app:
            z2.installProduct(app, "Products.CAS4PAS")

        # Load ZCML
        import collective.castle

        self.loadZCML(package=collective.castle, context=configurationContext)
コード例 #21
0
ファイル: testing.py プロジェクト: treinhard/onegov.policy
    def setUpDefaultContent(self, app):
        # Do not install plone site in this base layer,
        # so that we can reuse it an setup multiple sites
        # with different languages in sequence.

        with z2.zopeApp() as app:
            app['acl_users'].userFolderAddUser(
                SITE_OWNER_NAME,
                SITE_OWNER_PASSWORD,
                ['Manager'],
                [])
コード例 #22
0
ファイル: testing.py プロジェクト: 4teamwork/ftw.linkchecker
 def setUp(self):
     self['zodbDB'] = zodb.stackDemoStorage(self.get('zodbDB'),
                                            name='PloneFixture')
     self.setUpZCML()
     with z2.zopeApp() as app:
         self.setUpProducts(app)
         self.setUpDefaultContent(app)
         for ADDITIONAL_PAGE in ADDITIONAL_PAGES_TO_SETUP:
             self.setUpDefaultContent_AdditionalPage(
                 app, ADDITIONAL_PAGE['page_id'],
                 ADDITIONAL_PAGE['page_title'])
コード例 #23
0
ファイル: layers.py プロジェクト: affinitic/plone.app.testing
    def setUp(self):

        # Stack a new DemoStorage on top of the one from z2.STARTUP.
        self['zodbDB'] = zodb.stackDemoStorage(self.get('zodbDB'), name='PloneFixture')

        self.setUpZCML()

        # Set up products and the default content
        with z2.zopeApp() as app:
            self.setUpProducts(app)
            self.setUpDefaultContent(app)
コード例 #24
0
    def setUp(self):

        # Stack a new DemoStorage on top of the one from z2.STARTUP.
        self["zodbDB"] = zodb.stackDemoStorage(self.get("zodbDB"), name="PloneFixture")

        self.setUpZCML()

        # Set up products and the default content
        with z2.zopeApp() as app:
            self.setUpProducts(app)
            self.setUpDefaultContent(app)
コード例 #25
0
ファイル: testing.py プロジェクト: 4teamwork/ftw.topics
    def setUp(self):
        # Stack a new DemoStorage
        self['zodbDB'] = zodb.stackDemoStorage(
            self.get('zodbDB'), name='SimplelayoutTopicsLayer')

        with z2.zopeApp() as app:
            z2.installProduct(app, 'simplelayout.types.common')
            z2.installProduct(app, 'ftw.contentpage')

        with ploneSite() as portal:
            applyProfile(portal, 'ftw.topics:simplelayout')
コード例 #26
0
 def setUp(self):
     with z2.zopeApp() as app:
         portal = app[PLONE_SITE_ID]
         portal.email_from_address = '*****@*****.**'
         portal.email_from_name = 'Plone Site'
         portal._original_MailHost = portal.MailHost
         portal.MailHost = mailhost = MockMailHost('MailHost')
         portal.MailHost.smtp_host = 'localhost'
         sm = getSiteManager(context=portal)
         sm.unregisterUtility(provided=IMailHost)
         sm.registerUtility(mailhost, provided=IMailHost)
コード例 #27
0
    def tearDown(self):

        # Tear down products
        with z2.zopeApp() as app:
            # note: content tear-down happens by squashing the ZODB
            self.tearDownProducts(app)

        self.tearDownZCML()

        # Zap the stacked ZODB
        self['zodbDB'].close()
        del self['zodbDB']
コード例 #28
0
    def tearDown(self):

        # Tear down products
        with z2.zopeApp() as app:
            # note: content tear-down happens by squashing the ZODB
            self.tearDownProducts(app)

        self.tearDownZCML()

        # Zap the stacked ZODB
        self['zodbDB'].close()
        del self['zodbDB']
コード例 #29
0
ファイル: cmf_layers.py プロジェクト: jakke/plone.bbb_testing
    def setUp(self):

        # Stack a new DemoStorage on top of the one from z2.STARTUP.
        self['zodbDB'] = zodb.stackDemoStorage(self.get('zodbDB'),
            name='CMFPortalFixture')

        self.setUpZCML()

        # Set up products and the default content
        with z2.zopeApp() as app:
            self.setUpProducts(app)
            self.setUpDefaultContent(app)
コード例 #30
0
    def setUpPloneSite(self, portal):
        applyProfile(portal, 'jarn.xmpp.collaboration:default')
        registry = getUtility(IRegistry)
        registry['jarn.xmpp.collaborationJID'] = 'collaboration.localhost'

        if HAS_DEXTERITY:
            self.applyProfile(portal, 'plone.app.dexterity:default')

            # Surely there are better ways of doing this than TTW, feel free to
            # replace.
            import transaction
            from plone.testing.z2 import Browser
            from plone.app.testing import TEST_USER_ID, TEST_USER_PASSWORD
            from plone.app.testing import setRoles
            from plone.testing import z2

            setRoles(portal, TEST_USER_ID, ['Manager'])
            transaction.commit()

            with z2.zopeApp() as app:
                browser = Browser(app)
                browser.handleErrors = False
                browser.addHeader('Authorization', 'Basic %s:%s' %
                    (TEST_USER_ID, TEST_USER_PASSWORD, ))
                # Create a type
                browser.open('http://nohost/plone/@@dexterity-types')
                browser.getControl('Add New Content Type').click()
                browser.getControl('Type Name').value = 'MyType'
                browser.getControl('Short Name').value = 'mytype'
                browser.getControl('Add').click()

                #Add fields
                browser.getLink('MyType').click()
                fields = [('textline', 'Text line (String)'),
                          ('text', 'Text'),
                          ('richtext', 'Rich Text')]

                for field_id, field_type in fields:
                    browser.getControl('Add new field').click()
                    browser.getControl('Title').value = field_id
                    browser.getControl('Short Name').value = field_id
                    browser.getControl('Field type').getControl(
                        value=field_type).selected = True
                    browser.getControl('Add').click()

            # Setup behaviors
            portal.portal_types.mytype.behaviors = (
                'plone.app.dexterity.behaviors.metadata.IDublinCore',
                'plone.app.content.interfaces.INameFromTitle',
                'jarn.xmpp.collaboration.interfaces.ICollaborativelyEditable')
            setRoles(portal, TEST_USER_ID, ['Member'])
コード例 #31
0
ファイル: testing.py プロジェクト: 4teamwork/ftw.linkchecker
 def ploneSite(self, plone_site_id, db=None, connection=None, environ=None):
     from zope.site.hooks import setSite, getSite, setHooks
     setHooks()
     site = getSite()
     with z2.zopeApp(db, connection, environ) as app:
         portal = app[plone_site_id]
         setSite(portal)
         login(portal, TEST_USER_NAME)
         try:
             yield portal
         finally:
             logout()
             if site is not portal:
                 setSite(site)
コード例 #32
0
ファイル: test_patches.py プロジェクト: erral/ftw.inflator
    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))
コード例 #33
0
    def test_customize_image(self):
        self.load_zcml_string('\n'.join((
                    '<configure xmlns:inflator="http://namespaces.zope.org/inflator"'
                    '           i18n_domain="my.package"'
                    '           package="ftw.inflator.tests">',
                    '    <inflator:customize',
                    '        image="../resources/plone-logo.png" />',
                    '</configure>'
                    )))

        image = get_merged_customizations().image
        self.assertEquals(image, '++resource++inflator-plone-logo-10.png')

        with z2.zopeApp() as app:
            self.assertTrue(app.unrestrictedTraverse(image))
コード例 #34
0
ファイル: layers.py プロジェクト: gotcha/silva.testing
    def tearDown(self):

        # Tear down products
        for app in z2.zopeApp():
            # note: content tear-down happens by squashing the ZODB
            self.tearDownProducts(app)

        from zope.app.component.hooks import resetHooks
        resetHooks()

        self.tearDownZCML()

        # Zap the stacked ZODB
        self['zodbDB'].close()
        del self['zodbDB']
コード例 #35
0
    def test_setuphandler(self):
        default_profile_path = os.path.join(
            os.path.dirname(ftw.bridge.client.__file__), 'profiles', 'default')

        with z2.zopeApp() as app:
            acl_users = app.acl_users
            self.assertFalse(setuphandlers.PLUGIN_ID in acl_users.objectIds())

            setup = DirectoryImportContext(app.acl_users, default_profile_path)
            setuphandlers.setup_bridge_pas_plugin(setup)

            self.assertTrue(setuphandlers.PLUGIN_ID in acl_users.objectIds())

            # Does not fail on another call
            setuphandlers.setup_bridge_pas_plugin(setup)
コード例 #36
0
ファイル: layers.py プロジェクト: gotcha/silva.testing
    def setUp(self):

        # Stack a new DemoStorage on top of the one from z2.STARTUP.
        self['zodbDB'] = zodb.stackDemoStorage(
            self.get('zodbDB'), name='SilvaFixture'
        )

        self.setUpZCML()

        from zope.app.component.hooks import setHooks
        setHooks()

        # Set up products and the default content
        for app in z2.zopeApp():
            self.setUpProducts(app)
            self.setUpDefaultContent(app)
コード例 #37
0
ファイル: layers.py プロジェクト: mostscript/uu.retrieval
 def setUp(self):
     self['zodbDB'] = zodb.stackDemoStorage(
         self.get('zodbDB'),
         name='CMFAppLayer',
         )
     with z2.zopeApp() as app:
         self.setUpTestUserContext(app)
         for pkg in self.PRODUCTS:
             z2.installProduct(app, pkg)
         self.setUpSite(app)
         transaction.commit()
     global_components = zca.pushGlobalRegistry()
     site = self.get('site')
     local_components = site.getSiteManager()
     if global_components not in local_components.__bases__:
         local_components.__bases__ = (global_components,)
コード例 #38
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))
コード例 #39
0
    def test_setuphandler(self):
        default_profile_path = os.path.join(
            os.path.dirname(ftw.bridge.client.__file__),
            'profiles', 'default')

        with z2.zopeApp() as app:
            acl_users = app.acl_users
            self.assertFalse(
                setuphandlers.PLUGIN_ID in acl_users.objectIds())

            setup = DirectoryImportContext(app.acl_users,
                                           default_profile_path)
            setuphandlers.setup_bridge_pas_plugin(setup)

            self.assertTrue(setuphandlers.PLUGIN_ID in acl_users.objectIds())

            # Does not fail on another call
            setuphandlers.setup_bridge_pas_plugin(setup)
コード例 #40
0
ファイル: layers.py プロジェクト: upiq/upiqsite.teamwork
 def setUpZope(self, app, configurationContext):
     """load package zcml to initialize product"""
     import z3c.form
     self.loadZCML(name='meta.zcml', package=z3c.form)
     self.loadZCML(package=z3c.form)  # needed for testing product views
     import plone.uuid
     self.loadZCML(package=plone.uuid)
     import collective.z3cform.datagridfield
     self.loadZCML(package=collective.z3cform.datagridfield)
     import Products.CMFPlacefulWorkflow
     self.loadZCML(package=Products.CMFPlacefulWorkflow)
     import plone.app.iterate
     self.loadZCML(package=plone.app.iterate)
     with z2.zopeApp() as app:
         z2.installProduct(app, 'Products.DateRecurringIndex')
     import uu.workflows
     self.loadZCML(package=uu.workflows)
     import collective.teamwork
     self.loadZCML(package=collective.teamwork)
     import upiqsite.teamwork
     self.loadZCML(package=upiqsite.teamwork)
コード例 #41
0
ファイル: testing.py プロジェクト: treinhard/onegov.policy
    def setUp(self):
        # Stack a new DemoStorage
        self['zodbDB'] = zodb.stackDemoStorage(
            self.get('zodbDB'), name='BundleLayer:%s' % self.language)

        with z2.zopeApp() as app:
            z2.login(app['acl_users'], SITE_OWNER_NAME)

            # instll a plone site with the bundle
            bundle = get_bundle_by_name('OneGov Box (Example content)')
            bundle.install(app, PLONE_SITE_ID, language=self.language)

            # create the plone test user
            pas = app[PLONE_SITE_ID]['acl_users']
            pas.source_users.addUser(
                    TEST_USER_ID,
                    TEST_USER_NAME,
                    TEST_USER_PASSWORD)
            for role in TEST_USER_ROLES:
                pas.portal_role_manager.doAssignRoleToPrincipal(TEST_USER_ID, role)

            z2.logout()
コード例 #42
0
    def tearDown(self):

        with z2.zopeApp() as app:

            portal = app[PLONE_SITE_ID]

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

            # Allow subclass to tear down persistent fixture
            self.tearDownPloneSite(portal)

            setSite(None)

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

            security.popCheckers()

            # Pop the component registry, thus removing component
            # architecture registrations
            popGlobalRegistry(portal)

            # Remove PAS plugins
            self.tearDownMultiPlugins()

            # Allow subclass to tear down products
            self.tearDownZope(app)

        # Zap the configuration context
        del self['configurationContext']

        # Pop the demo storage, thus restoring the database to the
        # previous state
        self['zodbDB'].close()
        del self['zodbDB']
コード例 #43
0
 def setUp(self):
     with z2.zopeApp() as app:
         ZopeTestCase.utils.setupCoreSessions(app)
コード例 #44
0
 def setUp(self):
     with z2.zopeApp() as app:
         z2.installProduct(app, 'Products.PTProfiler')
コード例 #45
0
 def setUp(self):
     with z2.zopeApp() as app:
         z2.installProduct(app, 'Products.DateRecurringIndex')
コード例 #46
0
ファイル: testing.py プロジェクト: maikroeder/ftw.inflator
 def setUpDefaultContent(self, app):
     # do not create plone site
     with z2.zopeApp() as app:
         app['acl_users'].userFolderAddUser(SITE_OWNER_NAME,
                                            SITE_OWNER_PASSWORD,
                                            ['Manager'], [])
コード例 #47
0
 def tearDown(self):
     with z2.zopeApp() as app:
         z2.installProduct(app, 'Products.PTProfiler')
コード例 #48
0
 def tearDown(self):
     with z2.zopeApp() as app:
         z2.uninstallProduct(app, 'plone.app.linkintegrity')
コード例 #49
0
 def tearDown(self):
     with z2.zopeApp() as app:
         z2.uninstallProduct(app, 'Products.DateRecurringIndex')