[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server/VFS/tests - testOSFileSystem.py:1.1.2.3
Stephan Richter
srichter@cbu.edu
Tue, 2 Apr 2002 20:10:37 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Server/VFS/tests
In directory cvs.zope.org:/tmp/cvs-serv9918/tests
Modified Files:
Tag: Zope3-Server-Branch
testOSFileSystem.py
Log Message:
Finished writing OSFileSystem tests.
=== Zope3/lib/python/Zope/Server/VFS/tests/testOSFileSystem.py 1.1.2.2 => 1.1.2.3 ===
+ def testChmod(self):
+ path = os.path.join(self.root, 'foo')
+ open(path, 'w').write('writing test')
+ mode = 6*2**6 + 4*2**3 + 4*2**0 # 644
+ self.filesystem.chmod('foo', mode)
+ self.assertEqual(('%o' %os.stat(path)[stat.ST_MODE])[-3:], '644')
+ os.remove(path)
+
+
+ def testChown(self):
+ path = os.path.join(self.root, 'foo')
+ open(path, 'w').write('writing test')
+ self.filesystem.chown('foo', 500, 500)
+ self.assertEqual(os.stat(path)[stat.ST_UID], 500)
+ self.assertEqual(os.stat(path)[stat.ST_GID], 500)
+ os.remove(path)
+
+
+ def testLink(self):
+ path = os.path.join(self.root, 'foo')
+ open(path, 'w').write('writing test')
+ self.filesystem.link('foo', 'foo1')
+ self.failUnless(os.path.exists(path+'1'))
+ os.remove(path)
+ os.remove(path+'1')
+
+
+ def testMkdir(self):
+ path = os.path.join(self.root, 'foo')
+ self.filesystem.mkdir('foo')
+ self.failUnless(os.path.exists(path))
+ self.failUnless(os.path.isdir(path))
+ os.rmdir(path)
+
+
+ def testFifo(self):
+ path = os.path.join(self.root, 'foo')
+ self.filesystem.mkfifo(path)
+ self.failUnless(os.path.exists(path))
+ os.remove(path)
+
+
+ def testRemove(self):
+ path = os.path.join(self.root, 'foo')
+ open(path, 'w').write('writing test')
+ self.filesystem.remove('foo')
+ self.failIf(os.path.exists(path))
+
+
+ def testRmdir(self):
+ path = os.path.join(self.root, 'foo')
+ os.mkdir(path)
+ self.filesystem.rmdir('foo')
+ self.failIf(os.path.exists(path))
+
+
+ def testRename(self):
+ path = os.path.join(self.root, 'foo')
+ open(path, 'w').write('writing test')
+ self.filesystem.rename('foo', 'foo1')
+ self.failUnless(os.path.exists(path+'1'))
+ os.remove(path+'1')
+
+
+ def testSymlink(self):
+ path = os.path.join(self.root, 'foo')
+ open(path, 'w').write('writing test')
+ self.filesystem.symlink('foo', 'foo1')
+ self.failUnless(os.path.exists(path+'1'))
+ os.remove(path)
+ os.remove(path+'1')
+
+
+ def testUnlink(self):
+ path = os.path.join(self.root, 'foo')
+ open(path, 'w').write('writing test')
+ self.filesystem.unlink('foo')
+ self.failIf(os.path.exists(path))
+
+
+ def testWrite(self):
+ path = os.path.join(self.root, 'foo')
+ file = open(path, 'w')
+ self.assertEqual(self.filesystem.write(file.fileno(), 'foo bar'), 7)
+ file.close()
+ os.remove(path)
+
+
def testInterface(self):
self.failUnless(
IReadFileSystem.isImplementedByInstancesOf(self.filesystem_class))