Erik Grinaker avatar 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")
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.