本文整理汇总了Python中Products.Archetypes.tests.atsitetestcase.ATSiteTestCase.afterSetUp方法的典型用法代码示例。如果您正苦于以下问题:Python ATSiteTestCase.afterSetUp方法的具体用法?Python ATSiteTestCase.afterSetUp怎么用?Python ATSiteTestCase.afterSetUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.Archetypes.tests.atsitetestcase.ATSiteTestCase
的用法示例。
在下文中一共展示了ATSiteTestCase.afterSetUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
self.setRoles(['Manager'])
self.portal.invokeFactory('Folder', 'test_folder_')
self.folder = self.portal.test_folder_
t = self._type
self.portal.portal_workflow.setChainForPortalTypes((t,), ('plone_workflow',))
self.inst = inst = makeContent(self.folder, portal_type=t, id=t)
self.object_id = t
self.attrs = [f.getName() for f in inst.Schema().fields()
if isinstance(f.getStorage(), AttributeStorage)]
self.check_attrs = """\
content = getattr(context, '%(object_id)s')
for attr in %(attrs)s:
print getattr(content, attr, None)
""" % {'object_id': self.object_id,
'attrs': self.attrs}
self.check_methods = """\
content = getattr(context, '%(object_id)s')
for meth in %(methods)s:
print getattr(content, meth)()
""" % {'object_id': self.object_id,
'methods': ['foo']}
self.logout()
示例2: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
self.setRoles(['Manager'])
ATSiteTestCase.afterSetUp(self)
self._dummy = mkDummyInContext(Dummy, oid='dummy', context=self.portal,
schema=schema)
txt_file.seek(0)
img_file.seek(0)
示例3: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
self._dummy = mkDummyInContext(klass=Dummy, oid='dummy',
context=self.portal, schema=schema)
# to enable overrideDiscussionFor
self.setRoles(['Manager'])
self.makeDummy()
addMetadataTo(self._dummy)
示例4: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
# install AT within portal
self.login()
self.demo_instances = []
for t in self.demo_types:
inst = makeContent(self.folder, portal_type=t, id=t)
self.demo_instances.append(inst)
示例5: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
self.attool = self.portal.archetype_tool
# Calling mkDummyInContext adds content, but also registers
# our classes and adds a copy of the schema.
self._dummy1 = mkDummyInContext(
Dummy1, oid='dummy1', context=self.portal, schema=schema1)
self._dummy2 = mkDummyInContext(
Dummy2, oid='dummy2', context=self.portal, schema=schema2)
示例6: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
self.pt = self.portal.portal_transforms
valid_tags = copy.deepcopy(VALID_TAGS)
valid_tags['script'] = 1
nasty_tags = copy.deepcopy(NASTY_TAGS)
del nasty_tags['script']
self.pt.unregisterTransform('safe_html')
self.pt.registerTransform(SafeHTML(nasty_tags=nasty_tags,
valid_tags=valid_tags))
示例7: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
atapi.registerType(Dummy, 'Archetypes')
content_types, constructors, ftis = atapi.process_types(atapi.listTypes(), PKG_NAME)
portal = self.portal
dummy = Dummy(oid='dummy')
# put dummy in context of portal
dummy = dummy.__of__(portal)
portal.dummy = dummy
dummy.initializeArchetype()
self._dummy = dummy
示例8: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ArcheSiteTestCase.afterSetUp(self)
self.loginAsPortalOwner()
# Because we add skins this needs to be called. Um... ick.
self._refreshSkinData()
self.login()
mdc = getToolByName(self.portal, 'portal_memberdata')
mdc.unit_test_mode = True # suppress registration emails
# add event subscriber to listen to all channel events
self.listen_for_object_events()
示例9: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
registerType(Dummy, "Archetypes")
content_types, constructors, ftis = process_types(listTypes(), PKG_NAME)
portal = self.portal
dummy = Dummy(oid="dummy")
# put dummy in context of portal
dummy = dummy.__of__(portal)
portal.dummy = dummy
dummy.initializeArchetype()
self._dummy = dummy
示例10: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
self.setRoles(['Manager'])
imgpath = os.path.join(PACKAGE_HOME, os.pardir, 'tool.gif')
self._image = open(imgpath).read()
portal = self.portal
portal.invokeFactory('DDocument', id='document')
doc = portal.document
doc.setBody('testdata', mimetype='text/x-rst')
doc.setImage(self._image, mimetype='image/gif')
示例11: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
# install AT within portal
self.login()
self.demo_instances = []
for t in self.demo_types:
# XXX: Fails with "Unauthorized" exception from
# CMFDefault/DiscussionTool.py:84, in overrideDiscussionFor
#
# Note that BaseObject.initializeArchetype has a bare except
# that prints out the error instead of letting it through, so
# that there is no exception when running the test.
inst = makeContent(self.folder, portal_type=t, id=t)
self.demo_instances.append(inst)
示例12: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
self._dummy = mkDummyInContext(klass=Dummy, oid='dummy',
context=self.portal, schema=schema)
gen_class(DummyFolder)
# to enable overrideDiscussionFor
self.setRoles(['Manager'])
parent = mkDummyInContext(klass=DummyFolder, oid='parent',
context=self.portal, schema=None)
self._parent = parent
# create dummy
self._dummy = mkDummyInContext(klass=Dummy, oid='dummy',
context=parent, schema=None)
示例13: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
self._dummy = mkDummyInContext(Dummy, oid='dummy', context=self.portal,
schema=schema)
示例14: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
self.registry = self.portal.mimetypes_registry
示例15: afterSetUp
# 需要导入模块: from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase [as 别名]
# 或者: from Products.Archetypes.tests.atsitetestcase.ATSiteTestCase import afterSetUp [as 别名]
def afterSetUp(self):
ATSiteTestCase.afterSetUp(self)
self.loginAsPortalOwner()
for product in PRODUCTS:
self.addProduct(product)
self.pt = self.portal.portal_transforms