[Zope3-checkins] CVS: Zope3/src/zope/app/container/tests - test_objectmover.py:1.1.2.4
Sidnei da Silva
sidnei@x3ng.com.br
Tue, 4 Feb 2003 11:50:43 -0500
Update of /cvs-repository/Zope3/src/zope/app/container/tests
In directory cvs.zope.org:/tmp/cvs-serv20722/src/zope/app/container/tests
Modified Files:
Tag: paris-copypasterename-branch
test_objectmover.py
Log Message:
Third stab at getting tests right. Remember that my lucky number is 8.
=== Zope3/src/zope/app/container/tests/test_objectmover.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/app/container/tests/test_objectmover.py:1.1.2.3 Tue Feb 4 11:34:17 2003
+++ Zope3/src/zope/app/container/tests/test_objectmover.py Tue Feb 4 11:50:41 2003
@@ -18,13 +18,15 @@
"""
from unittest import TestCase, TestSuite, main, makeSuite
-
+from zope.app.traversing import traverse
from zope.app.services.tests.placefulsetup import PlacefulSetup
from zope.component import getAdapter
from zope.component.adapter import provideAdapter
from zope.app.interfaces.copy import IObjectMover, IObjectCopier
from zope.app.interfaces.container import IPasteTarget
+from zope.app.interfaces.container import IMoveSource
from zope.app.container.copy import PasteTarget
+from zope.app.container.copy import MoveSource
from zope.app.copy import ObjectMover, ObjectCopier
from zope.app.content.folder import Folder
from zope.app.content.file import File
@@ -36,12 +38,13 @@
PlacefulSetup.buildFolders(self)
provideAdapter(None, IObjectMover, ObjectMover)
provideAdapter(None, IPasteTarget, PasteTarget)
+ provideAdapter(None, IMoveSource, MoveSource)
def test_moveto(self):
root = self.rootFolder
- container = root.get('folder1')
+ container = traverse(root, 'folder1')
container.setObject('file1', File())
- file = container.get('file1')
+ file = traverse(root, 'folder1/file1')
mover = getAdapter(file, IObjectMover)
paster = getAdapter(container, IPasteTarget)
mover.moveTo(paster, 'file2')
@@ -50,9 +53,9 @@
def test_moveable(self):
root = self.rootFolder
- container = root.get('folder1')
+ container = traverse(root, 'folder1')
container.setObject('file1', File())
- file = container.get('file1')
+ file = traverse(root, 'folder1/file1')
mover = getAdapter(file, IObjectMover)
self.failUnless(mover.moveable())
@@ -60,11 +63,11 @@
# A file should not be moveable in its same folder.
#
root = self.rootFolder
- container = root.get('folder1')
+ container = traverse(root, 'folder1')
container.setObject('file1', File())
- file = container.get('file1')
+ file = traverse(root, 'folder1/file1')
mover = getAdapter(file, IObjectMover)
- self.failIf(mover.moveableTo(self._container, 'file1'))
+ self.failIf(mover.moveableTo(container, 'file1'))
def test_suite():
return TestSuite((