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

Guido van Rossum guido@python.org
Wed, 28 May 2003 10:55:58 -0400


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

Modified Files:
	test_committer.py 
Log Message:
Use self.readfile() rather than abusing Committer.read_file() for
testing.


=== Zope3/src/zope/app/fssync/tests/test_committer.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/fssync/tests/test_committer.py:1.3	Wed May 28 10:49:08 2003
+++ Zope3/src/zope/app/fssync/tests/test_committer.py	Wed May 28 10:55:57 2003
@@ -282,8 +282,8 @@
         self.assertEqual(self.com.get_errors(), [])
         self.assertEqual(parent.holding, {"child": child})
         self.assertEqual(child.holding, {"foo": foo})
-        self.assertEqual(self.com.read_file(foofile), dumps(foo))
-        self.assertEqual(self.com.read_file(originalfoofile), dumps(foo))
+        self.assertEqual(self.readfile(foofile, "rb"), dumps(foo))
+        self.assertEqual(self.readfile(originalfoofile, "rb"), dumps(foo))
 
         # Test modifying a file
         newfoo = {"x": 42}
@@ -292,8 +292,8 @@
         self.assertEqual(self.com.get_errors(), [])
         self.assertEqual(parent.holding, {"child": child})
         self.assertEqual(child.holding, {"foo": newfoo})
-        self.assertEqual(self.com.read_file(foofile), dumps(newfoo))
-        self.assertEqual(self.com.read_file(originalfoofile), dumps(newfoo))
+        self.assertEqual(self.readfile(foofile, "rb"), dumps(newfoo))
+        self.assertEqual(self.readfile(originalfoofile, "rb"), dumps(newfoo))
 
         # Test adding a file
         bar = {"y": 42}
@@ -304,8 +304,8 @@
         self.writefile(dumps(bar), barfile)
         self.com.synch(parent, "", parentdir)
         self.assertEqual(child.holding, {"foo": newfoo, "bar": bar})
-        self.assertEqual(self.com.read_file(barfile), dumps(bar))
-        self.assertEqual(self.com.read_file(originalbarfile), dumps(bar))
+        self.assertEqual(self.readfile(barfile, "rb"), dumps(bar))
+        self.assertEqual(self.readfile(originalbarfile, "rb"), dumps(bar))
         self.assertEqual(barentry.get("flag"), None)
 
         # Test removing a file
@@ -323,8 +323,8 @@
         fooentry["type"] = "__builtin__.int"
         self.com.synch(parent, "", parentdir)
         self.assertEqual(child.holding, {"foo": altfoo})
-        self.assertEqual(self.com.read_file(foofile), dumps(altfoo))
-        self.assertEqual(self.com.read_file(originalfoofile), dumps(altfoo))
+        self.assertEqual(self.readfile(foofile, "rb"), dumps(altfoo))
+        self.assertEqual(self.readfile(originalfoofile, "rb"), dumps(altfoo))
 
         # Test adding an empty directory
         kwikdir = os.path.join(childdir, "kwik")
@@ -364,7 +364,7 @@
         self.assertEqual(kwekentry.get("flag"), None)
         self.assertEqual(kwakentry.get("flag"), None)
         self.failUnless(os.path.isfile(kwakfile))
-        self.assertEqual(self.com.read_file(kwakfile), data)
+        self.assertEqual(self.readfile(kwakfile, "rb"), data)
         self.failUnless(os.path.isfile(fsutil.getoriginal(kwakfile)))
 
         # Test removing the subtree rooted at kwek
@@ -382,8 +382,8 @@
         self.writefile("something else", originalfoofile)
         self.com.synch(parent, "", parentdir)
         self.assertEqual(self.com.get_errors(), [foofile])
-        self.assertEqual(self.com.read_file(foofile),
-                         self.com.read_file(originalfoofile))
+        self.assertEqual(self.readfile(foofile, "rb"),
+                         self.readfile(originalfoofile, "rb"))
 
         # Test conflict reporting for object added in both places
         os.remove(originalfoofile)