[Zope3-checkins] CVS: Zope3/src/zope/fssync/tests - test_fsmerger.py:1.10

Guido van Rossum guido@python.org
Tue, 3 Jun 2003 14:24:35 -0400


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

Modified Files:
	test_fsmerger.py 
Log Message:
I discovered a cluster of cases that weren't handled correctly, where
a remote directory tree was removed.  Unit tests for these cases were
conspicuously absent!  Fixed all that.  Also renamed some unit tests:
'tree' now refers to a non-empty directory tree, 'dir' refers to an
empty directory.



=== Zope3/src/zope/fssync/tests/test_fsmerger.py 1.9 => 1.10 ===
--- Zope3/src/zope/fssync/tests/test_fsmerger.py:1.9	Thu May 29 11:07:30 2003
+++ Zope3/src/zope/fssync/tests/test_fsmerger.py	Tue Jun  3 14:24:35 2003
@@ -365,7 +365,7 @@
 
     # Tests for added empty directories: local, remote, both
 
-    def test_added_emptydir_local(self):
+    def test_added_dir_local(self):
         added_entry = {"flag": "added"}
         added_entry.update(self.entry)
         self.mergetest("foo", {}, None, None,
@@ -374,14 +374,14 @@
                        {}, None, None,
                        added_entry, {})
 
-    def test_added__emptydir_remote(self):
+    def test_added__dir_remote(self):
         self.mergetest("foo", None, None, {},
                        None, self.entry,
                        ["N %l/"],
                        {}, {}, {},
                        self.entry, self.entry)
 
-    def test_added_emptydir_both(self):
+    def test_added_dir_both(self):
         added_entry = {"flag": "added"}
         added_entry.update(self.entry)
         self.mergetest("foo", {}, None, {},
@@ -390,9 +390,9 @@
                        {}, None, {},
                        self.entry, self.entry)
 
-    # Tests for added non-empty directories: local, remote, both
+    # Tests for added directory trees: local, remote, both
 
-    def test_added_dir_local(self):
+    def test_added_tree_local(self):
         added_entry = {"flag": "added"}
         added_entry.update(self.entry)
         self.mergetest("foo", {"x": "x"}, None, None,
@@ -401,14 +401,14 @@
                        {"x": "x"}, None, None,
                        added_entry, {})
 
-    def test_added_dir_remote(self):
+    def test_added_tree_remote(self):
         self.mergetest("foo", None, None, {"x": "x"},
                        None, self.entry,
                        ["N %l/", "U %l/x"],
                        {"x": "x"}, {"x": "x"}, {"x": "x"},
                        self.entry, self.entry)
 
-    def test_added_dir_both(self):
+    def test_added_tree_both(self):
         added_entry = {"flag": "added"}
         added_entry.update(self.entry)
         self.mergetest("foo", {"x": "x"}, None, {"x": "x"},
@@ -419,7 +419,7 @@
 
     # Tests for removed empty directories: local, remote, both
 
-    def test_removed_emptydir_local(self):
+    def test_removed_dir_local(self):
         removed_entry = {"flag": "removed"}
         removed_entry.update(self.entry)
         self.mergetest("foo", None, None, {},
@@ -428,14 +428,14 @@
                        None, None, {},
                        removed_entry, self.entry)
 
-    def test_removed_emptydir_remote(self):
+    def test_removed_dir_remote(self):
         self.mergetest("foo", {}, None, None,
                        self.entry, {},
                        ["D %l/"],
                        None, None, None,
                        {}, {})
 
-    def test_removed_emptydir_both(self):
+    def test_removed_dir_both(self):
         removed_entry = {"flag": "removed"}
         removed_entry.update(self.entry)
         self.mergetest("foo", None, None, None,
@@ -444,7 +444,32 @@
                        None, None, None,
                        {}, {})
 
-    # XXX Tests for removed non-empty directories?
+    # Tests for removed non-empty directories: local, remote, both
+
+    def test_removed_tree_local(self):
+        removed_entry = {"flag": "removed"}
+        removed_entry.update(self.entry)
+        self.mergetest("foo", None, None, {"x": "x"},
+                       removed_entry, self.entry,
+                       ["R %l/"],
+                       None, None, {"x": "x"},
+                       removed_entry, self.entry)
+
+    def test_removed_tree_remote(self):
+        self.mergetest("foo", {"x": "x"}, {"x": "x"}, None,
+                       self.entry, {},
+                       ["D %l/x", "D %l/"],
+                       None, None, None,
+                       {}, {})
+
+    def test_removed_tree_both(self):
+        removed_entry = {"flag": "removed"}
+        removed_entry.update(self.entry)
+        self.mergetest("foo", None, None, None,
+                       removed_entry, {},
+                       ["D %l"],
+                       None, None, None,
+                       {}, {})
 
 def test_suite():
     s = unittest.TestSuite()