[Zope3-checkins] CVS: Zope3/src/zope/app/container/tests - test_objectmover.py:1.1.2.3
Sidnei da Silva
sidnei@x3ng.com.br
Tue, 4 Feb 2003 11:34:19 -0500
Update of /cvs-repository/Zope3/src/zope/app/container/tests
In directory cvs.zope.org:/tmp/cvs-serv17125/src/zope/app/container/tests
Modified Files:
Tag: paris-copypasterename-branch
test_objectmover.py
Log Message:
Second stab at getting tests right
=== Zope3/src/zope/app/container/tests/test_objectmover.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/container/tests/test_objectmover.py:1.1.2.2 Tue Feb 4 11:02:17 2003
+++ Zope3/src/zope/app/container/tests/test_objectmover.py Tue Feb 4 11:34:17 2003
@@ -18,7 +18,8 @@
"""
from unittest import TestCase, TestSuite, main, makeSuite
-from zope.app.tests.placelesssetup import PlacelessSetup
+
+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
@@ -28,37 +29,42 @@
from zope.app.content.folder import Folder
from zope.app.content.file import File
-class ObjectMoverTest(PlacelessSetup, TestCase):
+class ObjectMoverTest(PlacefulSetup, TestCase):
def setUp(self):
- PlacelessSetup.setUp(self)
+ PlacefulSetup.setUp(self)
+ PlacefulSetup.buildFolders(self)
provideAdapter(None, IObjectMover, ObjectMover)
provideAdapter(None, IPasteTarget, PasteTarget)
def test_moveto(self):
- self._container=Folder()
- self._container.setObject('file1', File())
- file=self._container.get('file1')
- mover=getAdapter(file, IObjectMover)
- paster=getAdapter(self._container, IPasteTarget)
+ root = self.rootFolder
+ container = root.get('folder1')
+ container.setObject('file1', File())
+ file = container.get('file1')
+ mover = getAdapter(file, IObjectMover)
+ paster = getAdapter(container, IPasteTarget)
mover.moveTo(paster, 'file2')
- assert 'file1' not in self._container
- assert 'file2' in self._container
+ self.failIf('file1' in self._container)
+ self.failUnless('file2' in self._container)
def test_moveable(self):
- self._container=Folder()
- self._container.setObject('file1', File())
- file=self._container.get('file1')
- mover=getAdapter(file, IObjectMover)
- assert mover.moveable()
+ root = self.rootFolder
+ container = root.get('folder1')
+ container.setObject('file1', File())
+ file = container.get('file1')
+ mover = getAdapter(file, IObjectMover)
+ self.failUnless(mover.moveable())
def test_moveableTo(self):
# A file should not be moveable in its same folder.
#
- self._container=Folder()
- self._container.setObject('file1', File())
- mover=getAdapter(self._container.get('file1'), IObjectMover)
- assert not mover.moveableTo(self._container, 'file1')
+ root = self.rootFolder
+ container = root.get('folder1')
+ container.setObject('file1', File())
+ file = container.get('file1')
+ mover = getAdapter(file, IObjectMover)
+ self.failIf(mover.moveableTo(self._container, 'file1'))
def test_suite():
return TestSuite((