本文整理汇总了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()
示例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
示例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
示例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)
示例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)
示例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)
示例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()
示例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)
示例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))
示例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')
示例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)