def afterSetUp(self): ATTestCase.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()
def afterSetUp(self): ATTestCase.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()
def afterSetUp(self): ATTestCase.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)
def afterSetUp(self): ATTestCase.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)
def afterSetUp(self): self.setRoles(['Manager']) ATTestCase.afterSetUp(self) self._dummy = mkDummyInContext(Dummy, oid='dummy', context=self.portal, schema=schema) txt_file.seek(0) img_file.seek(0) pdf_file.seek(0)
def afterSetUp(self): ATTestCase.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)
def afterSetUp(self): ATTestCase.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)
def afterSetUp(self): self.setRoles(['Manager']) ATTestCase.afterSetUp(self) self._dummy = mkDummyInContext(Dummy, oid='dummy', context=self.portal, schema=schema) txt_file.seek(0) img_file.seek(0) pdf_file.seek(0)
def afterSetUp(self): # Set up a content object with a field that has a word # document in it ATTestCase.afterSetUp(self) self.dummy = mkDummyInContext( Dummy, oid='dummy', context=self.portal, schema=schema) self.field = self.dummy.getField('textfield') ptpath = PortalTransforms.__path__[0] self.wordfile = open('%s/tests/input/test.doc' % ptpath) self.field.getMutator(self.dummy)(self.wordfile.read()) self.request = self.app.REQUEST self.response = self.request.response
def afterSetUp(self): ATTestCase.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')
def afterSetUp(self): ATTestCase.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)
def afterSetUp(self): ATTestCase.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
def afterSetUp(self): ATTestCase.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
def afterSetUp(self): # Set up a content object with a field that has a word # document in it ATTestCase.afterSetUp(self) self.dummy = mkDummyInContext(Dummy, oid='dummy', context=self.portal, schema=schema) self.field = self.dummy.getField('textfield') ptpath = PortalTransforms.__path__[0] self.wordfile = open('%s/tests/input/test.doc' % ptpath) self.field.getMutator(self.dummy)(self.wordfile.read()) self.request = self.app.REQUEST self.response = self.request.response
def afterSetUp(self): ATTestCase.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)
def afterSetUp(self): ATTestCase.afterSetUp(self) self._dummy = mkDummyInContext(Dummy, oid='dummy', context=self.portal, schema=schema)
def afterSetUp(self): ATTestCase.afterSetUp(self) for c in counts: c.reset() for name, meth in meths.items(): wrap_method(BaseContent, name, meth, pattern='__test_%s__')
def afterSetUp(self): ATTestCase.afterSetUp(self) self._dummy = mkDummyInContext(Dummy, oid='dummy', context=self.portal, schema=schema)