Пример #1
0
 def setUp(self):
     super(ObjectManagerTests, self).setUp()
     self.saved_cfg_debug_mode = getConfiguration().debug_mode
     import Zope2.App
     zcml.load_config('meta.zcml', Zope2.App)
     import OFS
     zcml.load_config('configure.zcml', OFS)
     setDeprecatedManageAddDelete(ItemForDeletion)
Пример #2
0
 def setUp(self):
     super(ObjectManagerTests, self).setUp()
     self.saved_cfg_debug_mode = getConfiguration().debug_mode
     import Zope2.App
     zcml.load_config('meta.zcml', Zope2.App)
     import OFS
     zcml.load_config('configure.zcml', OFS)
     setDeprecatedManageAddDelete(ItemForDeletion)
 def afterSetUp(self):
     setDeprecatedManageAddDelete(DummyContent)
     self.catalog = getToolByName(self.portal, 'portal_catalog')
     self.folder._setObject('doc1',
                            DummyContent('doc1', catalog=self.catalog))
     self.doc1 = self.folder.doc1
     self.folder._setObject('doc2',
                            DummyContent('doc2', catalog=self.catalog))
     self.doc2 = self.folder.doc2
Пример #4
0
 def afterSetUp(self):
     setDeprecatedManageAddDelete(DummyContent)
     self.catalog = getToolByName(self.portal, 'portal_catalog')
     self.folder._setObject('doc1',
         DummyContent('doc1', catalog=self.catalog))
     self.doc1 = self.folder.doc1
     self.folder._setObject('doc2',
         DummyContent('doc2', catalog=self.catalog))
     self.doc2 = self.folder.doc2
 def setUp(self):
     self.portal = self.layer['portal']
     self.portal.invokeFactory('Folder', 'folder1')
     self.folder = self.portal['folder1']
     setDeprecatedManageAddDelete(DummyContent)
     self.catalog = getToolByName(self.portal, 'portal_catalog')
     self.folder._setObject('doc1',
                            DummyContent('doc1', catalog=self.catalog))
     self.doc1 = self.folder.doc1
     self.folder._setObject('doc2',
                            DummyContent('doc2', catalog=self.catalog))
     self.doc2 = self.folder.doc2
 def setUp(cls):
     cleanup.cleanUp()
     zcml.load_site(force=True)
     setDeprecatedManageAddDelete(TestItem)
     setDeprecatedManageAddDelete(TestFolder)
Пример #7
0
from OFS.Cache import CacheManager
from OFS.Folder import Folder
from OFS.metaconfigure import setDeprecatedManageAddDelete
from OFS.SimpleItem import SimpleItem

import unittest


class DummyCacheManager(CacheManager, SimpleItem):
    def __init__(self, id, *args, **kw):
        self.id = id


setDeprecatedManageAddDelete(DummyCacheManager)


class CacheTests(unittest.TestCase):
    def test_managersExist(self):
        from OFS.Cache import managersExist
        from OFS.DTMLMethod import DTMLMethod
        root = Folder('root')
        root._setObject('root_cache', DummyCacheManager('root_cache'))
        root._setObject('child', Folder('child'))
        root.child._setObject('child_cache', DummyCacheManager('child_cache'))
        root.child._setObject('child_content', DTMLMethod('child_content'))

        # To begin with, cache managers will be found correctly
        # using managersExist
        self.assertTrue(managersExist(root.child.child_content))

        # Now we delete the cache in the child folder
Пример #8
0
 def setUp(cls):
     cleanup.cleanUp()
     zcml.load_site(force=True)
     setDeprecatedManageAddDelete(TestItem)
     setDeprecatedManageAddDelete(TestFolder)
Пример #9
0
import unittest

from OFS.Cache import CacheManager
from OFS.Folder import Folder
from OFS.SimpleItem import SimpleItem
from OFS.metaconfigure import setDeprecatedManageAddDelete


class DummyCacheManager(CacheManager, SimpleItem):
    def __init__(self, id, *args, **kw):
        self.id = id
setDeprecatedManageAddDelete(DummyCacheManager)


class CacheTests(unittest.TestCase):

    def test_managersExist(self):
        from OFS.Cache import managersExist
        from OFS.DTMLMethod import DTMLMethod
        root = Folder('root')
        root._setObject('root_cache', DummyCacheManager('root_cache'))
        root._setObject('child', Folder('child'))
        root.child._setObject('child_cache', DummyCacheManager('child_cache'))
        root.child._setObject('child_content', DTMLMethod('child_content'))

        # To begin with, cache managers will be found correctly
        # using managersExist
        self.assertTrue(managersExist(root.child.child_content))

        # Now we delete the cache in the child folder
        root.child.manage_delObjects(['child_cache'])