当前位置: 首页>>代码示例>>Python>>正文


Python PlacelessSetup.setUp方法代码示例

本文整理汇总了Python中Products.CMFCore.tests.base.testcase.PlacelessSetup.setUp方法的典型用法代码示例。如果您正苦于以下问题:Python PlacelessSetup.setUp方法的具体用法?Python PlacelessSetup.setUp怎么用?Python PlacelessSetup.setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products.CMFCore.tests.base.testcase.PlacelessSetup的用法示例。


在下文中一共展示了PlacelessSetup.setUp方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from Products.CMFCore.tests.base.testcase import PlacelessSetup [as 别名]
# 或者: from Products.CMFCore.tests.base.testcase.PlacelessSetup import setUp [as 别名]
    def setUp(self):
        import Products.CMFCore
        import Products.Five
        from Products.Five import zcml
        import Products.GenericSetup
        PlacelessSetup.setUp(self)
        RequestTest.setUp(self)
        zcml.load_config('meta.zcml', Products.Five)
        zcml.load_config('permissions.zcml', Products.Five)
        zcml.load_config('configure.zcml', Products.GenericSetup)
        zcml.load_config('configure.zcml', Products.CMFCore)
        zcml.load_config('configure.zcml', Products.DCWorkflow)

        factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
        factory('site', 'CMFDefault:default', snapshot=False)
        self.site = self.root.site
        self.site._setObject( 'topic', Topic('topic') )
        self.topic = self.site.topic
        self.topic.addCriterion('modified', 'Friendly Date Criterion')
        self.topic.addCriterion('portal_type', 'String Criterion')
        type_crit = self.topic.getCriterion('portal_type')
        type_crit.edit(value='Dummy Content')
        self.criterion = self.topic.getCriterion('modified')
        self.now = DateTime()
        self._old_as_of = _replace_DC__as_of(lambda: self.now)

        for i in self.day_diffs:
            dummy_id = 'dummy%i' % i
            self.site._setObject( dummy_id, DummyContent( id=dummy_id
                                                        , catalog=1
                                                        ) )
            dummy_ob = getattr(self.site, dummy_id)
            dummy_ob.modified_date = self.now + i
            dummy_ob.reindexObject()
开发者ID:goschtl,项目名称:zope,代码行数:36,代码来源:test_DateC.py

示例2: setUp

# 需要导入模块: from Products.CMFCore.tests.base.testcase import PlacelessSetup [as 别名]
# 或者: from Products.CMFCore.tests.base.testcase.PlacelessSetup import setUp [as 别名]
 def setUp(self):
     PlacelessSetup.setUp(self)
     RequestTest.setUp(self)
     zcml.load_config('meta.zcml', Products.Five)
     zcml.load_config('permissions.zcml', Products.Five)
     zcml.load_config('configure.zcml', Products.GenericSetup)
     zcml.load_config('configure.zcml', Products.CMFCore)
     zcml.load_config('configure.zcml', Products.DCWorkflow)
     zcml.load_string(_TRAVERSE_ZCML)
     try:
         newSecurityManager(None, UnrestrictedUser('manager', '', ['Manager'], []))
         factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
         factory('cmf', 'CMFDefault:default', snapshot=False)
         self.site = self.root.cmf
         self.site.invokeFactory('File', id='file')
         self.site.portal_workflow.doActionFor(self.site.file, 'publish')
         self.site.invokeFactory('Image', id='image')
         self.site.portal_workflow.doActionFor(self.site.image, 'publish')
         self.site.invokeFactory('Folder', id='subfolder')
         self.subfolder = self.site.subfolder
         self.workflow = self.site.portal_workflow
         transaction.savepoint(optimistic=True) # Make sure we have _p_jars
     except:
         self.tearDown()
         raise
开发者ID:goschtl,项目名称:zope,代码行数:27,代码来源:test_Image.py

示例3: setUp

# 需要导入模块: from Products.CMFCore.tests.base.testcase import PlacelessSetup [as 别名]
# 或者: from Products.CMFCore.tests.base.testcase.PlacelessSetup import setUp [as 别名]
 def setUp(self):
     PlacelessSetup.setUp(self)
     RequestTest.setUp(self)
     zcml.load_config('meta.zcml', Products.Five)
     zcml.load_config('permissions.zcml', Products.Five)
     zcml.load_config('configure.zcml', Products.GenericSetup)
     zcml.load_config('configure.zcml', Products.CMFCore)
     zcml.load_config('configure.zcml', Products.DCWorkflow)
     zcml.load_string(_TRAVERSE_ZCML)
     try:
         factory = self.root.manage_addProduct['CMFDefault'].addConfiguredSite
         factory('cmf', 'CMFDefault:default', snapshot=False)
         self.portal = self.root.cmf
         # Become a Manager
         self.uf = self.portal.acl_users
         self.uf.userFolderAddUser('manager', '', ['Manager'], [])
         self.login('manager')
         # Make a document
         self.discussion = self.portal.portal_discussion
         self.portal.invokeFactory('Document', id='doc')
         self.discussion.overrideDiscussionFor(self.portal.doc, 1)
         # Publish it
         self.workflow = self.portal.portal_workflow
         self.workflow.doActionFor(self.portal.doc, 'publish')
     except:
         self.tearDown()
         raise
开发者ID:goschtl,项目名称:zope,代码行数:29,代码来源:test_DiscussionReply.py

示例4: setUp

# 需要导入模块: from Products.CMFCore.tests.base.testcase import PlacelessSetup [as 别名]
# 或者: from Products.CMFCore.tests.base.testcase.PlacelessSetup import setUp [as 别名]
    def setUp(self):
        import Products.CMFCore.exportimport

        PlacelessSetup.setUp(self)
        BaseRegistryTests.setUp(self)
        zcml.load_config('meta.zcml', Products.Five)
        zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
开发者ID:goschtl,项目名称:zope,代码行数:9,代码来源:test_properties.py

示例5: setUp

# 需要导入模块: from Products.CMFCore.tests.base.testcase import PlacelessSetup [as 别名]
# 或者: from Products.CMFCore.tests.base.testcase.PlacelessSetup import setUp [as 别名]
    def setUp(self):
        import Products.GenericSetup.MailHost

        PlacelessSetup.setUp(self)
        BaseRegistryTests.setUp(self)
        zcml.load_config('meta.zcml', Products.Five)
        zcml.load_config('configure.zcml', Products.GenericSetup.MailHost)
开发者ID:goschtl,项目名称:zope,代码行数:9,代码来源:test_mailhost.py

示例6: setUp

# 需要导入模块: from Products.CMFCore.tests.base.testcase import PlacelessSetup [as 别名]
# 或者: from Products.CMFCore.tests.base.testcase.PlacelessSetup import setUp [as 别名]
 def setUp( self ):
     PlacelessSetup.setUp(self)
     SecurityRequestTest.setUp( self )
     self._trap_warning_output()
     zcml.load_config('meta.zcml', Products.Five)
     zcml.load_config('configure.zcml', Products.GenericSetup)
     zcml.load_config('configure.zcml', Products.CMFCore)
开发者ID:goschtl,项目名称:zope,代码行数:9,代码来源:test_Portal.py

示例7: setUp

# 需要导入模块: from Products.CMFCore.tests.base.testcase import PlacelessSetup [as 别名]
# 或者: from Products.CMFCore.tests.base.testcase.PlacelessSetup import setUp [as 别名]
    def setUp(self):
        import Products.CMFCore
        import Products.Five
        from Products.Five import zcml
        import Products.GenericSetup

        PlacelessSetup.setUp(self)
        RequestTest.setUp(self)
        zcml.load_config("meta.zcml", Products.Five)
        zcml.load_config("permissions.zcml", Products.Five)
        zcml.load_config("configure.zcml", Products.GenericSetup)
        zcml.load_config("configure.zcml", Products.CMFCore)
        zcml.load_config("configure.zcml", Products.DCWorkflow)

        factory = self.root.manage_addProduct["CMFDefault"].addConfiguredSite
        factory("site", "CMFDefault:default", snapshot=False)
        self.site = self.root.site
        self.site._setObject("topic", Topic("topic"))
        self.topic = self.site.topic
        self.topic.addCriterion("modified", "Friendly Date Criterion")
        self.topic.addCriterion("portal_type", "String Criterion")
        type_crit = self.topic.getCriterion("portal_type")
        type_crit.edit(value="Dummy Content")
        self.criterion = self.topic.getCriterion("modified")
        self.now = DateTime()

        for i in self.day_diffs:
            dummy_id = "dummy%i" % i
            self.site._setObject(dummy_id, DummyContent(id=dummy_id, catalog=1))
            dummy_ob = getattr(self.site, dummy_id)
            dummy_ob.modified_date = self.now + i
            dummy_ob.reindexObject()
开发者ID:wpjunior,项目名称:proled,代码行数:34,代码来源:test_DateC.py

示例8: setUp

# 需要导入模块: from Products.CMFCore.tests.base.testcase import PlacelessSetup [as 别名]
# 或者: from Products.CMFCore.tests.base.testcase.PlacelessSetup import setUp [as 别名]
 def setUp(self):
     PlacelessSetup.setUp(self)
     SecurityRequestTest.setUp(self)
     zcml.load_config('meta.zcml', Products.Five)
     zcml.load_config('permissions.zcml', Products.Five)
     zcml.load_config('configure.zcml', Products.GenericSetup)
     zcml.load_config('configure.zcml', Products.CMFCore)
     zcml.load_config('configure.zcml', Products.DCWorkflow)
开发者ID:goschtl,项目名称:zope,代码行数:10,代码来源:test_Portal.py

示例9: setUp

# 需要导入模块: from Products.CMFCore.tests.base.testcase import PlacelessSetup [as 别名]
# 或者: from Products.CMFCore.tests.base.testcase.PlacelessSetup import setUp [as 别名]
    def setUp(self):
        from zope.component import provideHandler
        from zope.app.event.interfaces import IObjectEvent
        from Products.CMFCore.interfaces import ICookieCrumbler
        from Products.CMFCore.CookieCrumbler import handleCookieCrumblerEvent

        PlacelessSetup.setUp(self)
        self._finally = None

        provideHandler(handleCookieCrumblerEvent,
                       adapts=(ICookieCrumbler, IObjectEvent))
开发者ID:goschtl,项目名称:zope,代码行数:13,代码来源:test_CookieCrumbler.py

示例10: setUp

# 需要导入模块: from Products.CMFCore.tests.base.testcase import PlacelessSetup [as 别名]
# 或者: from Products.CMFCore.tests.base.testcase.PlacelessSetup import setUp [as 别名]
    def setUp(self):
        import Products.CMFCore
        PlacelessSetup.setUp(self)
        TransactionalTest.setUp(self)
        zcml.load_config('meta.zcml', Products.Five)
        zcml.load_config('permissions.zcml', Products.Five)
        zcml.load_config('configure.zcml', Products.CMFCore)
        zcml.load_string(_TRAVERSE_ZCML)

        root = self.root
        root._setObject('portal', DummyContent('portal', 'url_portal'))
        portal = self.portal = root.portal
        portal.portal_membership = DummyMembershipTool()
        self.folder = DummyContent('foo', 'url_foo')
        self.object = DummyContent('bar', 'url_bar')
开发者ID:goschtl,项目名称:zope,代码行数:17,代码来源:test_ActionInformation.py

示例11: setUp

# 需要导入模块: from Products.CMFCore.tests.base.testcase import PlacelessSetup [as 别名]
# 或者: from Products.CMFCore.tests.base.testcase.PlacelessSetup import setUp [as 别名]
 def setUp(self):
     PlacelessSetup.setUp(self)
     BaseRegistryTests.setUp(self)
     zcml.load_config('meta.zcml', Products.Five)
     zcml.load_config('permissions.zcml', Products.Five)
     zcml.load_config('configure.zcml', Products.CMFCore)
开发者ID:goschtl,项目名称:zope,代码行数:8,代码来源:test_typeinfo.py


注:本文中的Products.CMFCore.tests.base.testcase.PlacelessSetup.setUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。