[Zope3-checkins] CVS: Zope3/src/zope/fssync/tests - test_merger.py:1.12

Guido van Rossum guido@python.org
Wed, 28 May 2003 16:24:04 -0400


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

Modified Files:
	test_merger.py 
Log Message:
When the "conflict" flag is set, report it or clear it.  With unit
test.


=== Zope3/src/zope/fssync/tests/test_merger.py 1.11 => 1.12 ===
--- Zope3/src/zope/fssync/tests/test_merger.py:1.11	Wed May 28 10:40:04 2003
+++ Zope3/src/zope/fssync/tests/test_merger.py	Wed May 28 16:24:03 2003
@@ -184,6 +184,25 @@
     def test_spurious(self):
         self.runtest("a", None, None, None, None, "a", "Nothing", "Spurious")
 
+    def test_conflict_report(self):
+        local = self.tempfile("CONFLICT")
+        orig = self.tempfile("x")
+        remote = self.tempfile("x")
+        md = MockMetadata()
+        m = Merger(md)
+        lentry = md.getentry(local)
+        lentry["path"] = "/foo"
+        lentry["conflict"] = mtime = os.path.getmtime(local)
+        rentry = md.getentry(remote)
+        rentry["path"] = "/foo"
+        action, state = m.classify_files(local, orig, remote)
+        self.assertEqual((action, state), ("Nothing", "Conflict"))
+        self.assertEqual(lentry.get("conflict"), mtime)
+        lentry["conflict"] = mtime+100
+        action, state = m.classify_files(local, orig, remote)
+        self.assertEqual((action, state), ("Nothing", "Modified"))
+        self.assertEqual(lentry.get("conflict"), None)
+
     # XXX need test cases for anomalies, e.g. files missing or present
     # in spite of metadata, or directories instead of files, etc.