def setUp(self): CASetup.setUp(self) ESetup.setUp(self) from Products.Reflecto.content.reflector import Reflector self.reflecto = Reflector('reflecto') self.indexview = MockIndexView() try: # Plone 3 needs a schema factory to be able to index things from Products.Archetypes.Schema.factory import instanceSchemaFactory provideAdapter(instanceSchemaFactory) except ImportError: pass # ease use of ITraversable by setting REQUEST to None self.reflecto.REQUEST = None # use the bog-standard traverser for views too provideAdapter(DefaultTraversable, (None, ), name='view') # DefaultTraversable will look up the view as 'index' setattr(self.reflecto, 'index', self.indexview) self.tmppath = tempfile.mkdtemp() self.reflecto.setRelativePath(self.tmppath) os.mkdir(os.path.join(self.tmppath, 'subdir')) open(os.path.join(self.tmppath, 'foo'), 'w') open(os.path.join(self.tmppath, 'subdir', 'bar'), 'w')
def setUp(self): PlacelessSetup.setUp(self) # Build up a wrapper chain root = C('root') interface.directlyProvides(root, IRoot) folder = C('folder') item = C('item') self.root = root # root is not usually wrapped self.folder = contained(folder, self.root, name='folder') self.item = contained(item, self.folder, name='item') self.unwrapped_item = item self.broken_chain_folder = contained(folder, None) self.broken_chain_item = contained( item, self.broken_chain_folder, name='item' ) root.folder = folder folder.item = item self.tr = Traverser(root) zope.component.provideAdapter(Traverser, (None,), ITraverser) zope.component.provideAdapter(DefaultTraversable, (None,), ITraversable) zope.component.provideAdapter(LocationPhysicallyLocatable, (None,), ILocationInfo) zope.component.provideAdapter(RootPhysicallyLocatable, (IRoot,), ILocationInfo)
def setUp(self): PlacelessSetup.setUp(self) # Build up a wrapper chain root = C('root') interface.directlyProvides(root, IRoot) folder = C('folder') item = C('item') self.root = root # root is not usually wrapped self.folder = contained(folder, self.root, name='folder') self.item = contained(item, self.folder, name='item') self.unwrapped_item = item self.broken_chain_folder = contained(folder, None) self.broken_chain_item = contained(item, self.broken_chain_folder, name='item') root.folder = folder folder.item = item self.tr = Traverser(root) zope.component.provideAdapter(Traverser, (None, ), ITraverser) zope.component.provideAdapter(DefaultTraversable, (None, ), ITraversable) zope.component.provideAdapter(LocationPhysicallyLocatable, (None, ), ILocationInfo) zope.component.provideAdapter(RootPhysicallyLocatable, (IRoot, ), ILocationInfo)
def setUp(self): CASetup.setUp(self) ESetup.setUp(self) from Products.Reflecto.content.reflector import Reflector self.reflecto = Reflector('reflecto') self.indexview = MockIndexView() try: # Plone 3 needs a schema factory to be able to index things from Products.Archetypes.Schema.factory import instanceSchemaFactory provideAdapter(instanceSchemaFactory) except ImportError: pass # ease use of ITraversable by setting REQUEST to None self.reflecto.REQUEST = None # use the bog-standard traverser for views too provideAdapter(DefaultTraversable, (None,), name='view') # DefaultTraversable will look up the view as 'index' setattr(self.reflecto, 'index', self.indexview) self.tmppath = tempfile.mkdtemp() self.reflecto.setRelativePath(self.tmppath) os.mkdir(os.path.join(self.tmppath, 'subdir')) open(os.path.join(self.tmppath, 'foo'), 'w') open(os.path.join(self.tmppath, 'subdir', 'bar'), 'w')
def setUp(self): PlacelessSetup.setUp(self) # Build up a wrapper chain self.root = C('root') self.folder = contained(C('folder'), self.root, name='folder') self.item = contained(C('item'), self.folder, name='item') self.tr = Traverser(self.item)
def setUp(self, doctesttest=None): CAPlacelessSetup.setUp(self) EventPlacelessSetup.setUp(self) ContainerPlacelessSetup.setUp(self) I18nPlacelessSetup.setUp(self) addCheckerPublic() newInteraction()
def setUp(self): PlacelessSetup.setUp(self) from zope.traversing.browser import AbsoluteURL, SiteAbsoluteURL browserView(None, "absolute_url", AbsoluteURL) browserView(IRoot, "absolute_url", SiteAbsoluteURL) browserView(None, "", AbsoluteURL, providing=IAbsoluteURL) browserView(IRoot, "", SiteAbsoluteURL, providing=IAbsoluteURL) zope.component.provideAdapter(FooLocation) zope.component.provideAdapter(HTTPCharsets, (IHTTPRequest,), IUserPreferredCharsets)
def setUp(self): PlacelessSetup.setUp(self) from zope.traversing.browser import AbsoluteURL, SiteAbsoluteURL browserView(None, 'absolute_url', AbsoluteURL) browserView(IRoot, 'absolute_url', SiteAbsoluteURL) browserView(None, '', AbsoluteURL, providing=IAbsoluteURL) browserView(IRoot, '', SiteAbsoluteURL, providing=IAbsoluteURL) zope.component.provideAdapter(FooLocation) zope.component.provideAdapter(HTTPCharsets, (IHTTPRequest,), IUserPreferredCharsets) # LocationProxy as set by zope.location # this makes a default LocationProxy for all objects that # don't define a more specific adapter zope.component.provideAdapter(LocationProxy, (Interface,), ILocation)
def setUp(self, doctesttest=None): CAPlacelessSetup.setUp(self) EventPlacelessSetup.setUp(self) ContainerPlacelessSetup.setUp(self) I18nPlacelessSetup.setUp(self) setUpPasswordManagers() ztapi.browserView(None, 'absolute_url', AbsoluteURL) ztapi.browserViewProviding(None, AbsoluteURL, IAbsoluteURL) from zope.security.testing import addCheckerPublic addCheckerPublic() from zope.security.management import newInteraction newInteraction() setVocabularyRegistry(None)
def setUp(self): PlacelessSetup.setUp(self) zope.component.provideAdapter(DefaultTraversable, (None,), ITraversable) zope.component.provideAdapter(LocationPhysicallyLocatable, (None,), ILocationInfo) zope.component.provideAdapter(RootPhysicallyLocatable, (IRoot,), ILocationInfo) self.root = root = C('root') directlyProvides(root, IRoot) self.folder = folder = contained(C('folder'), root, 'folder') self.item = item = contained(C('item'), folder, 'item') root.folder = folder folder.item = item self.tr = Traverser(ProxyFactory(root))
def setUp(self): from OFS.Folder import Folder SecurityTest.setUp(self) FSReSTMaker.setUp(self) PlacelessSetup.setUp(self) self.root._setObject('portal_skins', Folder('portal_skins')) self.skins = self.root.portal_skins self.skins._setObject('custom', Folder('custom')) self.custom = self.skins.custom self.skins._setObject('fsdir', Folder('fsdir')) self.fsdir = self.skins.fsdir self.fsdir._setObject('testReST', self._makeOne('testReST', 'testReST.rst')) self.fsReST = self.fsdir.testReST
def setUp( self ): from OFS.Folder import Folder SecurityTest.setUp( self ) FSReSTMaker.setUp(self) PlacelessSetup.setUp(self) self.root._setObject( 'portal_skins', Folder( 'portal_skins' ) ) self.skins = self.root.portal_skins self.skins._setObject( 'custom', Folder( 'custom' ) ) self.custom = self.skins.custom self.skins._setObject( 'fsdir', Folder( 'fsdir' ) ) self.fsdir = self.skins.fsdir self.fsdir._setObject( 'testReST' , self._makeOne( 'testReST', 'testReST.rst' ) ) self.fsReST = self.fsdir.testReST
def setUp(self): PlacelessSetup.setUp(self) provideAdapter(AttributeAnnotations) read = Permission('read', 'Read Something') provideUtility(read, IPermission, read.id) self.read = read.id write = Permission('write', 'Write Something') provideUtility(write, IPermission, write.id) self.write = write.id peon = Role('peon', 'Poor Slob') provideUtility(peon, IRole, peon.id) self.peon = peon.id manager = Role('manager', 'Supreme Being') provideUtility(manager, IRole, manager.id) self.manager = manager.id
def setUp(self): PlacelessSetup.setUp(self) zope.component.provideAdapter(DefaultTraversable, (None, ), ITraversable) zope.component.provideAdapter(LocationPhysicallyLocatable, (None, ), ILocationInfo) zope.component.provideAdapter(RootPhysicallyLocatable, (IRoot, ), ILocationInfo) self.root = root = C('root') directlyProvides(root, IRoot) self.folder = folder = contained(C('folder'), root, 'folder') self.item = item = contained(C('item'), folder, 'item') root.folder = folder folder.item = item self.tr = Traverser(ProxyFactory(root))
def setUp( self ): from OFS.Folder import Folder FSSTXMaker.setUp(self) SecurityTest.setUp( self ) _TemplateSwitcher.setUp( self ) PlacelessSetup.setUp(self) self.root._setObject( 'portal_skins', Folder( 'portal_skins' ) ) self.skins = self.root.portal_skins self.skins._setObject( 'custom', Folder( 'custom' ) ) self.custom = self.skins.custom self.skins._setObject( 'fsdir', Folder( 'fsdir' ) ) self.fsdir = self.skins.fsdir self.fsdir._setObject( 'testSTX' , self._makeOne( 'testSTX', 'testSTX.stx' ) ) self.fsSTX = self.fsdir.testSTX
def setUp(self): from OFS.Folder import Folder FSSTXMaker.setUp(self) SecurityTest.setUp(self) _TemplateSwitcher.setUp(self) PlacelessSetup.setUp(self) self.root._setObject('portal_skins', Folder('portal_skins')) self.skins = self.root.portal_skins self.skins._setObject('custom', Folder('custom')) self.custom = self.skins.custom self.skins._setObject('fsdir', Folder('fsdir')) self.fsdir = self.skins.fsdir self.fsdir._setObject('testSTX', self._makeOne('testSTX', 'testSTX.stx')) self.fsSTX = self.fsdir.testSTX
def setUp(self, doctesttest=None): CAPlacelessSetup.setUp(self) ContainerPlacelessSetup.setUp(self)
def setUp(self, doctesttest=None): CAPlacelessSetup.setUp(self) EventPlacelessSetup.setUp(self)
def setUp(self, doctesttest=None): CAPlacelessSetup.setUp(self) EventPlacelessSetup.setUp(self) PlacelessSetup.setUp(self)
def setUp(self): from zope.component import provideAdapter from zope.traversing.adapters import DefaultTraversable PlacelessSetup.setUp(self) provideAdapter(DefaultTraversable, (None,))
def setUp(self): PlacelessSetup.setUp(self)
def setUp(self): _TemplateSwitcher.setUp(self) FSSTXMaker.setUp(self) RequestTest.setUp(self) PlacelessSetup.setUp(self)
def setUp(self): from zope.testing.cleanup import cleanUp cleanUp() PlacelessSetup.setUp(self)
def setUp(self): RequestTest.setUp(self) FSReSTMaker.setUp(self) PlacelessSetup.setUp(self)
def setUp(self, folders=False, site=False): PlacelessSetup.setUp(self) setUpTraversal() if folders or site: return self.buildFolders(site)
def setUp(self): PlacelessSetup.setUp(self) import zope.formlibwidget XMLConfig('ftesting.zcml', zope.formlibwidget)() self.field = Object(ITestContact, __name__=u'foo')
def setUp(self): PlacelessSetup.setUp(self) browserView(I, 'page1', page1) browserView(I, 'collides_with_page1', collides_with_page1) browserView(I, 'works_with_page1', works_with_page1)
def setUp(self): PlacelessSetup.setUp(self) zope.component.provideAdapter(AttributeAnnotations)
def setUp(self, doctesttest=None): CAPlacelessSetup.setUp(self) EventPlacelessSetup.setUp(self) I18nPlacelessSetup.setUp(self) newInteraction()