Ignore:
Timestamp:
Apr 20, 2012 10:04:56 AM (12 years ago)
Author:
potar
Message:

Merged tests branch

Location:
quintagroup.plonetabs/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonetabs/trunk

    • Property svn:mergeinfo
      •  

        old new  
        11/quintagroup.plonetabs/branches/plone4:3076-3243 
         2/quintagroup.plonetabs/branches/tests:3394-3436 
  • quintagroup.plonetabs/trunk/quintagroup/plonetabs/tests/base.py

    r865 r3437  
    11try: 
    22    from zope.annotation.interfaces import IAnnotations 
     3    IAnnotations  # pyflakes 
    34except ImportError: 
    45    from zope.app.annotation.interfaces import IAnnotations 
    5  
    66from plone.browserlayer.layer import mark_layer 
    77 
    88from  Testing import ZopeTestCase as ztc 
    99from  Products.Five import zcml 
    10 from  Products.Five import fiveconfigure 
    1110from Products.CMFCore.utils import getToolByName 
    12 from Products.CMFCore.interfaces import IAction, IActionCategory 
    1311from Products.CMFCore.ActionInformation import Action, ActionCategory 
    1412from  Products.PloneTestCase import PloneTestCase as ptc 
     
    1816 
    1917#ztc.installProduct('Zope2Product') 
     18 
    2019 
    2120@onsetup 
     
    2726 
    2827setup_package() 
     28if ptc.PLONE30: 
     29    ptc.setupPloneSite(products=["plone.browserlayer"]) 
    2930ptc.setupPloneSite(products=['quintagroup.plonetabs']) 
    3031 
    3132_marker = object() 
    3233 
     34 
    3335class PloneTabsTestCase(ptc.PloneTestCase): 
    3436    """Common test base class""" 
    35      
     37 
    3638    def afterSetUp(self): 
    3739        # due to some reason plone.browserlayer is not marking REQUEST 
    3840        # with installed products layer interfaces 
    39         # so I'm doing it manually here  
     41        # so I'm doing it manually here 
    4042        class DummyEvent(object): 
    4143            def __init__(self, request): 
    4244                self.request = request 
    4345        mark_layer(self.portal, DummyEvent(self.portal.REQUEST)) 
    44      
     46 
    4547    def purgeCache(self, request): 
    4648        annotations = IAnnotations(request) 
     
    4850        if cache is not _marker: 
    4951            del annotations['plone.memoize'] 
    50      
     52 
    5153    def purgeActions(self): 
    5254        for obj in self.tool.objectValues(): 
     
    5658            #elif IActionCategory.providedBy(obj): 
    5759                #obj.manage_delObjects(ids=obj.objectIds()) 
    58      
     60 
    5961    def setupActions(self, parent, kids=PORTAL_ACTIONS): 
    6062        ids = parent.objectIds() 
     
    6870                if child.get('children', {}): 
    6971                    self.setupActions(getattr(parent, id), child['children']) 
    70      
     72 
    7173    def purgeContent(self): 
    7274        ids = [obj.id for obj in self.portal.listFolderContents()] 
    7375        self.portal.manage_delObjects(ids=ids) 
    74      
     76 
    7577    def setupContent(self, parent, kids=PORTAL_CONTENT): 
    7678        ids = parent.objectIds() 
     
    8082            if child.get('children', {}) and id in ids: 
    8183                self.setupContent(getattr(parent, id), child['children']) 
    82      
     84 
    8385    def _createType(self, container, portal_type, id, **kwargs): 
    8486        """Helper method to create content objects""" 
    8587        ttool = getToolByName(container, 'portal_types') 
    86         portal_catalog =  getToolByName(container, 'portal_catalog') 
    87      
     88        portal_catalog = getToolByName(container, 'portal_catalog') 
     89 
    8890        fti = ttool.getTypeInfo(portal_type) 
    8991        fti.constructInstance(container, id, **kwargs) 
    9092        obj = getattr(container.aq_inner.aq_explicit, id) 
    91      
     93 
    9294        # publish and reindex 
    9395        #self._publish_item(portal, obj) 
Note: See TracChangeset for help on using the changeset viewer.