[Zope3-checkins] CVS: Zope3/src/zope/app/fssync/tests - test_committer.py:1.13

Guido van Rossum guido@python.org
Thu, 5 Jun 2003 14:51:07 -0400


Update of /cvs-repository/Zope3/src/zope/app/fssync/tests
In directory cvs.zope.org:/tmp/cvs-serv13296

Modified Files:
	test_committer.py 
Log Message:
The code used when using an explicit factory was incomplete -- it
didn't set the data!  With unit tests.


=== Zope3/src/zope/app/fssync/tests/test_committer.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/fssync/tests/test_committer.py:1.12	Tue Jun  3 15:42:19 2003
+++ Zope3/src/zope/app/fssync/tests/test_committer.py	Thu Jun  5 14:51:07 2003
@@ -196,12 +196,23 @@
         self.assertRaises(SynchronizationError, committer.set_item,
                           container, "Foo", 42)
 
-    def test_create_object_factory(self):
+    def test_create_object_factory_file(self):
         container = {}
         entry = {"flag": "added", "factory": "__builtin__.int"}
         tfn = os.path.join(self.tempdir(), "foo")
+        self.writefile(dumps(0), tfn)
         committer.create_object(container, "foo", entry, tfn)
         self.assertEqual(container, {"foo": 0})
+
+    def test_create_object_factory_directory(self):
+        provideSynchronizer(PretendContainer, DirectoryAdapter)
+        container = {}
+        entry = {"flag": "added", "factory": PCname}
+        tfn = os.path.join(self.tempdir(), "foo")
+        os.mkdir(tfn)
+        committer.create_object(container, "foo", entry, tfn)
+        self.assertEqual(container.keys(), ["foo"])
+        self.assertEqual(container["foo"].__class__, PretendContainer)
 
     def test_create_object_default(self):
         container = {}