[Zope3-checkins] CVS: Zope3/src/zope/app/fssync/tests - test_committer.py:1.7
Guido van Rossum
guido@python.org
Thu, 29 May 2003 12:19:48 -0400
Update of /cvs-repository/Zope3/src/zope/app/fssync/tests
In directory cvs.zope.org:/tmp/cvs-serv10719
Modified Files:
test_committer.py
Log Message:
Add a test for the IDirectoryFactory code.
=== Zope3/src/zope/app/fssync/tests/test_committer.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/fssync/tests/test_committer.py:1.6 Wed May 28 11:16:19 2003
+++ Zope3/src/zope/app/fssync/tests/test_committer.py Thu May 29 12:19:47 2003
@@ -31,7 +31,7 @@
from zope.fssync.tests.tempfiles import TempFiles
from zope.app.interfaces.container import IContainer
-from zope.app.interfaces.file import IFileFactory
+from zope.app.interfaces.file import IFileFactory, IDirectoryFactory
from zope.app.interfaces.fssync import IGlobalFSSyncService
from zope.app.fssync.committer import Committer, SynchronizationError
@@ -249,6 +249,21 @@
self.com.create_object(container, "foo", entry, tfn)
self.assertEqual(container.holding, {"foo": ["hello", "world"]})
self.assertEqual(entry, {"factory": None, "type": "__builtin__.list"})
+
+ def test_create_object_idirectoryfactory(self):
+ def factory_maker(container):
+ def factory(name):
+ return PretendContainer()
+ return factory
+ provideSynchronizer(PretendContainer, DirectoryAdapter)
+ provideAdapter(IContainer, IDirectoryFactory, factory_maker)
+ container = PretendContainer()
+ entry = {"flag": "added"}
+ tfn = os.path.join(self.tempdir(), "foo")
+ os.mkdir(tfn)
+ self.com.create_object(container, "foo", entry, tfn)
+ self.assertEqual(container.holding["foo"].__class__, PretendContainer)
+ self.assertEqual(entry, {"factory": PCname, "type": PCname})
def test_synch(self):
# This is a big-ass test that tests various aspects of