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


Python ATSiteTestCase.afterSetUp方法代码示例

本文整理汇总了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()
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:28,代码来源:test_security.py

示例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)
开发者ID:adamcheasley,项目名称:Products.Archetypes,代码行数:9,代码来源:test_fields.py

示例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)
开发者ID:MrTango,项目名称:Products.Archetypes,代码行数:10,代码来源:test_metadata.py

示例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)
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:10,代码来源:test_cmfessentials.py

示例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)
开发者ID:seanupton,项目名称:Products.Archetypes,代码行数:11,代码来源:test_update_schema.py

示例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))
开发者ID:prakharjoshi,项目名称:Products.PortalTransforms,代码行数:12,代码来源:test_transforms.py

示例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
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:14,代码来源:test_baseschema.py

示例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()
开发者ID:socialplanning,项目名称:opencore,代码行数:14,代码来源:openplanstestcase.py

示例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
开发者ID:urska19,项目名称:Plone-test,代码行数:14,代码来源:test_languagevocabulary.py

示例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')
开发者ID:seanupton,项目名称:Products.Archetypes,代码行数:15,代码来源:test_copying.py

示例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)
开发者ID:dtgit,项目名称:dtedu,代码行数:16,代码来源:test_cmfessentials.py

示例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)
开发者ID:seanupton,项目名称:Products.Archetypes,代码行数:18,代码来源:test_metadata.py

示例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)
开发者ID:rristow,项目名称:Products.Archetypes,代码行数:6,代码来源:test_baseobject.py

示例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
开发者ID:dtgit,项目名称:dtedu,代码行数:5,代码来源:test_magic.py

示例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    
开发者ID:kroman0,项目名称:products,代码行数:8,代码来源:test_transforms.py


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