Commits

Erik Grinaker committed e4d0c97

fixed a couple of io module unit tests

Comments (0)

Files changed (3)

 	* on entry goto, the username isn't copied to the clipboard chain
 	if the username is given to the goto command
 
+	* fixed a couple of io unit tests
+
 2005-01-08  Erik Grinaker <erikg@codepoet.no>
 
 	* wrote more ui module unit tests (yawn)
 		if data is None:
 			data = ""
 
-		f = gnome.vfs.create(file, gnome.vfs.OPEN_WRITE)
+		if file_exists(file) == True:
+			f = gnome.vfs.open(file, gnome.vfs.OPEN_WRITE)
+
+		else:
+			f = gnome.vfs.create(file, gnome.vfs.OPEN_WRITE)
+
 		f.write(data)
 		f.close()
 
 	def test_invperm(self):
 		"file_read() without perms"
 
+		if io.file_exists("/tmp/iotest-perms") == True:
+			os.unlink("/tmp/iotest-perms")
+
 		io.file_write("/tmp/iotest-perms", "")
 		os.chmod("/tmp/iotest-perms", 0000)
 		self.assertRaises(IOError, io.file_read, "/tmp/iotest-perms")
 	def test_invperm(self):
 		"file_write() without perms"
 
-		io.file_write("/tmp/iotest-perms", "")
+		if io.file_exists("/tmp/iotest-perms"):
+			os.unlink("/tmp/iotest-perms")
+
+		io.file_write("/tmp/iotest-perms", "a")
 		os.chmod("/tmp/iotest-perms", 0000)
 		self.assertRaises(IOError, io.file_write, "/tmp/iotest-perms", "test123")