Changeset 3437 in products for quintagroup.plonetabs/trunk/quintagroup/plonetabs/tests/base.py
- Timestamp:
- Apr 20, 2012 10:04:56 AM (12 years ago)
- Location:
- quintagroup.plonetabs/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonetabs/trunk
- Property svn:mergeinfo
-
old new 1 1 /quintagroup.plonetabs/branches/plone4:3076-3243 2 /quintagroup.plonetabs/branches/tests:3394-3436
-
- Property svn:mergeinfo
-
quintagroup.plonetabs/trunk/quintagroup/plonetabs/tests/base.py
r865 r3437 1 1 try: 2 2 from zope.annotation.interfaces import IAnnotations 3 IAnnotations # pyflakes 3 4 except ImportError: 4 5 from zope.app.annotation.interfaces import IAnnotations 5 6 6 from plone.browserlayer.layer import mark_layer 7 7 8 8 from Testing import ZopeTestCase as ztc 9 9 from Products.Five import zcml 10 from Products.Five import fiveconfigure11 10 from Products.CMFCore.utils import getToolByName 12 from Products.CMFCore.interfaces import IAction, IActionCategory13 11 from Products.CMFCore.ActionInformation import Action, ActionCategory 14 12 from Products.PloneTestCase import PloneTestCase as ptc … … 18 16 19 17 #ztc.installProduct('Zope2Product') 18 20 19 21 20 @onsetup … … 27 26 28 27 setup_package() 28 if ptc.PLONE30: 29 ptc.setupPloneSite(products=["plone.browserlayer"]) 29 30 ptc.setupPloneSite(products=['quintagroup.plonetabs']) 30 31 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.