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)
Beispiel #2
0
 def tearDown(self):
     with ploneSite() as portal:
         portal.MailHost = portal._original_MailHost
         sm = getSiteManager(context=portal)
         sm.unregisterUtility(provided=IMailHost)
         sm.registerUtility(aq_base(portal._original_MailHost),
                            provided=IMailHost)
Beispiel #3
0
 def test_figurefile_publishing_date(self):
     """ Test effective date of EEAFigureFiles which should
         receive the same effective date from the EEAFigure parents
     """
     with ploneSite() as portal:
         print portal
         setRoles(portal, TEST_USER_ID, ['Manager'])
         login(portal, TEST_USER_NAME)
         wftool = portal.portal_workflow
         wftool.setDefaultChain("simple_publication_workflow")
         wftool.setChainForPortalTypes(('EEAFigure', ),
                                       'simple_publication_workflow')
         if not hasattr(portal, 'sandbox1'):
             portal.invokeFactory('Folder', 'sandbox1')
         sandbox = portal['sandbox1']
         sandbox.invokeFactory('EEAFigure', 'test1')
         figure = sandbox.objectValues()[0]
         figure.invokeFactory('EEAFigureFile', 'figurefile-test')
         figurefile = figure.objectValues()[0]
         before_figurefile_date = figurefile.effective_date
         wftool.doActionFor(figure, 'publish')
         after_figurefile_date = figurefile.effective_date
         figure_date = figure.effective_date
         condition = before_figurefile_date != after_figurefile_date and \
                     after_figurefile_date == figure_date
         self.failIf(
             condition,
             "FigureFile should have same effective date as EEAFigure parent"
         )
Beispiel #4
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)
    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)
        def setUp(self):
            import collective.js.speakjs
            xmlconfig.file('configure.zcml', collective.js.speakjs,
                           context=self['configurationContext'])

            with ploneSite() as portal:
                applyProfile(portal, 'collective.js.speakjs:default')
 def tearDown(self):
     with ploneSite() as portal:
         portal.MailHost = portal._original_MailHost
         sm = getSiteManager(context=portal)
         sm.unregisterUtility(provided=IMailHost)
         sm.registerUtility(aq_base(portal._original_MailHost),
                            provided=IMailHost)
Beispiel #8
0
        def setUp(self):
            import collective.js.speakjs
            xmlconfig.file('configure.zcml',
                           collective.js.speakjs,
                           context=self['configurationContext'])

            with ploneSite() as portal:
                applyProfile(portal, 'collective.js.speakjs:default')
Beispiel #9
0
    def setUp(self):
        with ploneSite() as portal:
            portal._setObject("RemoteKeywordsLibrary", RemoteKeywordsLibrary())

            # Define default workflow (because PLONE_FIXTURE doesn't set it);
            # This is not required by RemoteKeywordsLibary but is required for
            # our tests for the library.
            portal.portal_workflow.setDefaultChain("simple_publication_workflow")
Beispiel #10
0
    def test_reorder_groups(self):
        with ploneSite() as portal:
            tabs = portal.tabs
            tab1 = tabs['tab-1']

            tab1.reorder_groups(['group-2', 'group-1'])

            self.assertEquals(tab1.groups[0].title, 'group-2')
            self.assertEquals(tab1.groups[1].title, 'group-1')
Beispiel #11
0
    def test_reorder_groups_does_not_lose_groups(self):
        with ploneSite() as portal:
            tabs = portal.tabs
            tab1 = tabs['tab-1']
            orig_groups = tab1.groups[:]

            tab1.reorder_groups([5, 'a group that does not exist'])

            self.assertEquals(tab1.groups[0].title, orig_groups[0].title)
            self.assertEquals(tab1.groups[1].title, orig_groups[1].title)
    def setUp(self):
        with ploneSite() as portal:
            # Define available languages
            language_tool = getToolByName(portal, 'portal_languages')
            language_tool.addSupportedLanguage('ca')
            language_tool.addSupportedLanguage('es')

            # Setup language root folders
            setupTool = SetupMultilingualSite()
            setupTool.setupSite(portal)
Beispiel #13
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')
Beispiel #14
0
    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')
Beispiel #15
0
    def setUpContent(self):
        super(LinkIntegrityDXLayer, self).setUpContent()

        with ploneSite() as portal:
            # Create an object that does not provide the behavior to live along
            create(portal, 'News Item', id='news1', title='News 1')

            # create a DX NamedImage
            portal.invokeFactory('Image', 'image1')
            portal['image1'].image = NamedImage(GIF, 'image/gif',
                                                u'sample.gif')
Beispiel #16
0
 def setUp(self):
     with ploneSite() as portal:
         applyProfile(portal, 'plone.app.referenceablebehavior:default')
         ttool = getToolByName(portal, 'portal_types')
         ttool.getTypeInfo('Document').behaviors += (
             'plone.app.referenceablebehavior.referenceable.IReferenceable',
         )
         super(ReferenceableBehaviorLayer, self).setUp()
         
         portal.invokeFactory('Document', 'doc1')
         portal.invokeFactory('Document', 'doc2')
         portal.invokeFactory('Document', 'doc3')
Beispiel #17
0
 def setUp(self):
     # zope.testing-set environment variable is in place.
     from Products.CMFPlone.tests import utils
     with ploneSite() as portal:
         portal.email_from_address = '*****@*****.**'
         portal.email_from_name = 'Plone Site'
         portal._original_MailHost = portal.MailHost
         portal.MailHost = mailhost = utils.MockMailHost('MailHost')
         portal.MailHost.smtp_host = 'localhost'
         sm = getSiteManager(context=portal)
         sm.unregisterUtility(provided=IMailHost)
         sm.registerUtility(mailhost, provided=IMailHost)
Beispiel #18
0
    def test_reorder_links_does_not_lose_items(self):
        with ploneSite() as portal:
            tabs = portal.tabs
            tab1 = tabs['tab-1']

            group = tab1.get_group('group-1')
            links = group.links[:]

            group.reorder_links([None, None, None])

            self.assertTrue(links[0] in group.links)
            self.assertTrue(links[1] in group.links)
            self.assertTrue(links[2] in group.links)
Beispiel #19
0
    def setUp(self):
        with ploneSite() as portal:
            # Define available languages
            language_tool = getToolByName(portal, 'portal_languages')
            language_tool.addSupportedLanguage('ca')
            language_tool.addSupportedLanguage('es')

            # Enable request negotiator
            language_tool.use_request_negotiation = True

            # Setup language root folders
            setupTool = SetupMultilingualSite()
            setupTool.setupSite(portal)
Beispiel #20
0
    def setUp(self):
        with ploneSite() as portal:
            # Define available languages
            language_tool = getToolByName(portal, "portal_languages")
            language_tool.addSupportedLanguage("ca")
            language_tool.addSupportedLanguage("es")

            # Enable request negotiator
            language_tool.use_request_negotiation = True

            # Setup language root folders
            setupTool = SetupMultilingualSite()
            setupTool.setupSite(portal)
 def setUp(self):
     # Note: CMFPlone can be imported safely only when a certain
     # zope.testing-set environment variable is in place.
     from Products.CMFPlone.tests import utils
     with ploneSite() as portal:
         portal.email_from_address = '*****@*****.**'
         portal.email_from_name = 'Plone Site'
         portal._original_MailHost = portal.MailHost
         portal.MailHost = mailhost = utils.MockMailHost('MailHost')
         portal.MailHost.smtp_host = 'localhost'
         sm = getSiteManager(context=portal)
         sm.unregisterUtility(provided=IMailHost)
         sm.registerUtility(mailhost, provided=IMailHost)
Beispiel #22
0
    def setUp(self):
        with ploneSite() as portal:
            ttool = getToolByName(portal, 'portal_types')
            for type_info in self.types_providing_referencable_behavior:
                ttool.getTypeInfo(type_info).behaviors += (
                    'plone.app.relationfield.behavior.IRelatedItems',
                    'plone.app.referenceablebehavior.referenceable.IReferenceable',  # noqa
                )

            # FIXME: we need uid_catalog and referencer_catalog to keep
            #        plone.app.referencebehavior working. So load Archetypes
            #        profile to install those tools before we continue
            applyProfile(portal, 'Products.Archetypes:Archetypes')

        self.setUpContent()
Beispiel #23
0
    def test_reorder_links(self):
        with ploneSite() as portal:
            tabs = portal.tabs
            tab1 = tabs['tab-1']

            group = tab1.get_group('group-1')
            links = group.links[:]
            tmp = links[0]
            links[0] = links[1]
            links[1] = tmp

            group.reorder_links(links)

            self.assertEquals(group.links[0], links[0])
            self.assertEquals(group.links[1], links[1])
            self.assertEquals(group.links[2], links[2])
 def setUp(self):
     super(LocalRolesFieldLayer, self).setUp()
     with ploneSite() as portal:
         groups_tool = portal.portal_groups
         groups = {'mail_editor': ('john', 'jane'),
                   'mail_reviewer': ('jane', 'tom'),
                   'support_editor': ('kate', ),
                   'support_reviewer': ('kate', )}
         for group_id in groups:
             if group_id not in groups_tool.getGroupIds():
                 groups_tool.addGroup(group_id)
             for user in groups[group_id]:
                 if not api.user.get(username=user):
                     api.user.create(username=user, email='*****@*****.**')
                 api.group.add_user(groupname=group_id, username=user)
         if not api.user.get(username='******'):
             api.user.create(username='******', email='*****@*****.**')
Beispiel #25
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 setUp(self):
        with ploneSite() as portal:
            language_tool = getToolByName(portal, 'portal_languages')
            language_tool.addSupportedLanguage('ca')
            language_tool.addSupportedLanguage('es')

            setupTool = SetupMultilingualSite()
            setupTool.setupSite(portal)

            atdoc = makeContent(
                portal['en'], 'Document', id='atdoc', title='EN doc')
            atdoc.setLanguage('en')
            atdoc_ca = makeTranslation(atdoc, 'ca')
            atdoc_ca.edit(title="CA doc", language='ca')

            dxdoc = createContentInContainer(
                portal['en'], "dxdoc", id="dxdoc", title='EN doc')
            ILanguage(dxdoc).set_language('en')
            dxdoc_ca = makeTranslation(dxdoc, 'ca')
            dxdoc_ca.title = "CA doc"
            ILanguage(dxdoc_ca).set_language('ca')
Beispiel #27
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 tearDown(self):
     with ploneSite() as portal:
         portal.portal_workflow.setDefaultChain('')
 def setUp(self):
     with ploneSite() as portal:
         portal.portal_workflow.setDefaultChain(
             'simple_publication_workflow')
Beispiel #30
0
 def setUp(self):
     with ploneSite() as portal:
         portal._addRole('Proprietaire')
         acl_users = getToolByName(portal, 'acl_users')
         acl_users.userFolderAddUser('manager', 'secret', ['Manager'], [])
         acl_users.userFolderAddUser('proprio', 'secret', ['Proprietaire'], [])
Beispiel #31
0
    def setUpContent(self):
        super(LinkIntegrityATLayer, self).setUpContent()

        with ploneSite() as portal:
            create(portal, 'Image', id='image1', title='Image 1', image=GIF)
Beispiel #32
0
 def tearDown(self):
     with ploneSite() as portal:
         portal.portal_workflow.setDefaultChain('')
Beispiel #33
0
 def setUp(self):
     with ploneSite() as portal:
         pushGlobalRegistry(portal)
     super(Fixture, self).setUp()
Beispiel #34
0
 def setUp(self):
     with ploneSite() as site:
         applyProfile(site, 'plone.restapi:default')
 def setUp(self):
     with ploneSite() as portal:
         applyProfile(portal, 'plone.app.contenttypes:default')
         portal.portal_workflow.setDefaultChain(
             'simple_publication_workflow'
         )
 def setUp(self):
     with ploneSite() as portal:
         applyProfile(portal, 'plone.app.contenttypes:default')
Beispiel #37
0
def setUp(self):
    with ploneSite() as portal:
        setHooks()
        setSite(portal)
Beispiel #38
0
 def setUp(self):
     id_ = self.__name__.split(':')[-1]
     assert id_ not in globals(), "Conflicting remote library id: %s" % id_
     globals()[id_] = type(id_, self.libraryBases, {})
     with ploneSite() as portal:
         portal._setObject(id_, globals()[id_]())
Beispiel #39
0
 def tearDown(self):
     id_ = self.__name__.split(':')[-1]
     with ploneSite() as portal:
         if id_ in portal.objectIds():
             portal._delObject(id_)
     del globals()[id_]
Beispiel #40
0
    def setUpContent(self):
        super(LinkIntegrityDXLayer, self).setUpContent()

        with ploneSite() as portal:
            # Create an object that does not provide the behavior to live along
            create(portal, "News Item", id="news1", title="News 1")
Beispiel #41
0
 def tearDown(self):
     super(Fixture, self).tearDown()
     with ploneSite() as portal:
         popGlobalRegistry(portal)
Beispiel #42
0
 def tearDown(self):
     with ploneSite() as portal:
         portal._delObject("RemoteKeywordsLibrary")
Beispiel #43
0
 def testTearDown(self):
     truncate_sql_tables()
     from opengever.testing.sql import reset_ogds_sync_stamp
     with ploneSite() as portal:
         reset_ogds_sync_stamp(portal)
     super(OpengeverFixture, self).testTearDown()
Beispiel #44
0
 def setUp(self):
     id_ = self.__name__.split(':')[-1]
     assert id_ not in globals(), "Conflicting remote library id: %s" % id_
     globals()[id_] = type(id_, self.libraryBases, {})
     with ploneSite() as portal:
         portal._setObject(id_, globals()[id_]())
    def setUpContent(self):
        super(LinkIntegrityDXLayer, self).setUpContent()

        with ploneSite() as portal:
            # Create an object that does not provide the behavior to live along
            create(portal, 'News Item', id='news1', title='News 1')
Beispiel #46
0
 def tearDown(self):
     id_ = self.__name__.split(':')[-1]
     with ploneSite() as portal:
         if id_ in portal.objectIds():
             portal._delObject(id_)
     del globals()[id_]
Beispiel #47
0
 def testTearDown(self):
     truncate_sql_tables()
     from opengever.testing.sql import reset_ogds_sync_stamp
     with ploneSite() as portal:
         reset_ogds_sync_stamp(portal)
     super(OpengeverFixture, self).testTearDown()
Beispiel #48
0
 def setUp(self):
     with ploneSite() as portal:
         portal.portal_workflow.setDefaultChain(
             'simple_publication_workflow')