Changeset 3402 in products for quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/tests/base.py
- Timestamp:
- Apr 2, 2012 1:04:35 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/tests/base.py
r865 r3402 19 19 #ztc.installProduct('Zope2Product') 20 20 21 21 22 @onsetup 22 23 def setup_package(): … … 31 32 _marker = object() 32 33 34 33 35 class PloneTabsTestCase(ptc.PloneTestCase): 34 36 """Common test base class""" 35 37 36 38 def afterSetUp(self): 37 39 # due to some reason plone.browserlayer is not marking REQUEST 38 40 # with installed products layer interfaces 39 # so I'm doing it manually here 41 # so I'm doing it manually here 40 42 class DummyEvent(object): 41 43 def __init__(self, request): 42 44 self.request = request 43 45 mark_layer(self.portal, DummyEvent(self.portal.REQUEST)) 44 46 45 47 def purgeCache(self, request): 46 48 annotations = IAnnotations(request) … … 48 50 if cache is not _marker: 49 51 del annotations['plone.memoize'] 50 52 51 53 def purgeActions(self): 52 54 for obj in self.tool.objectValues(): … … 56 58 #elif IActionCategory.providedBy(obj): 57 59 #obj.manage_delObjects(ids=obj.objectIds()) 58 60 59 61 def setupActions(self, parent, kids=PORTAL_ACTIONS): 60 62 ids = parent.objectIds() … … 68 70 if child.get('children', {}): 69 71 self.setupActions(getattr(parent, id), child['children']) 70 72 71 73 def purgeContent(self): 72 74 ids = [obj.id for obj in self.portal.listFolderContents()] 73 75 self.portal.manage_delObjects(ids=ids) 74 76 75 77 def setupContent(self, parent, kids=PORTAL_CONTENT): 76 78 ids = parent.objectIds() … … 80 82 if child.get('children', {}) and id in ids: 81 83 self.setupContent(getattr(parent, id), child['children']) 82 84 83 85 def _createType(self, container, portal_type, id, **kwargs): 84 86 """Helper method to create content objects""" 85 87 ttool = getToolByName(container, 'portal_types') 86 portal_catalog = 87 88 portal_catalog = getToolByName(container, 'portal_catalog') 89 88 90 fti = ttool.getTypeInfo(portal_type) 89 91 fti.constructInstance(container, id, **kwargs) 90 92 obj = getattr(container.aq_inner.aq_explicit, id) 91 93 92 94 # publish and reindex 93 95 #self._publish_item(portal, obj)
Note: See TracChangeset
for help on using the changeset viewer.