Permalink
Browse files

test_stat

  • Loading branch information...
mikejs committed Oct 2, 2009
1 parent a0d1c88 commit f18621a9249362dd13122f38d4b3f6ffd88aec5d
Showing with 17 additions and 4 deletions.
  1. +17 −4 tests/basic.py
View
@@ -9,8 +9,7 @@
class BasicGridfsFUSETestCase(unittest.TestCase):
def setUp(self):
- self.mount = os.path.join(os.path.dirname(
- os.path.abspath(__file__)),
+ self.mount = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'mount')
os.mkdir('tests/mount')
subprocess.check_call(['./mount_gridfs', '--db=gridfstest',
@@ -25,14 +24,28 @@ def tearDown(self):
subprocess.check_call(['umount', self.mount])
os.rmdir(self.mount)
- def testreadwrite(self):
- with open(os.path.join(self.mount, 'testfile.txt'), 'w') as f:
+ def test_read_write(self):
+ with open(os.path.join(self.mount, 'testfile.txt'), 'w') as w:
w.write("This is a test of GridFS FUSE.")
with open(os.path.join(self.mount, 'testfile.txt'), 'r') as r:
self.assertEqual("This is a test of GridFS FUSE.",
r.read())
+ def test_stat(self):
+ import stat
+
+ path = os.path.join(self.mount, 'testfile.txt')
+ with open(path, 'w') as w:
+ w.write('test')
+
+ stat_result = os.stat(path)
+ mode = stat_result.st_mode
+
+ self.assert_(stat.S_ISREG(mode))
+ self.assertEquals(0555, stat.S_IMODE(mode))
+ self.assertEquals(4, stat_result.st_size)
+
def suite():
suite = unittest.TestSuite()
suite.addTest(BasicGridfsFUSETestCase())

0 comments on commit f18621a

Please sign in to comment.