]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
tahoe_fuse: system test: Verify file contents can be properly read.
authornejucomo <nejucomo@gmail.com>
Wed, 30 Jan 2008 10:14:48 +0000 (03:14 -0700)
committernejucomo <nejucomo@gmail.com>
Wed, 30 Jan 2008 10:14:48 +0000 (03:14 -0700)
contrib/fuse/runtests.py

index feee949ef24e9ba095c69b397d9ac33440ee2010..dca67006375399d614ce8636b9918435c1b4fb1c 100644 (file)
@@ -275,7 +275,6 @@ class SystemTest (object):
             cap = self.webapi_call('PUT', '/uri', body)
             self.attach_node(testcap, cap, fname)
 
-
             dname = 'dir_%d' % (i,)
             names.append(dname)
 
@@ -296,6 +295,24 @@ class SystemTest (object):
                 tmpl = 'Expected %r size of %r but fuse returned %r'
                 raise self.TestFailure(tmpl, file, size, st.st_size)
     
+    def test_file_contents(self, testcap, testdir):
+        name = 'hw.txt'
+        body = 'Hello World!'
+            
+        cap = self.webapi_call('PUT', '/uri', body)
+        self.attach_node(testcap, cap, name)
+
+        path = os.path.join(testdir, name)
+        try:
+            found = open(path, 'r').read()
+        except Exception, err:
+            tmpl = 'Could not read file contents of %r: %r'
+            raise self.TestFailure(tmpl, path, err)
+
+        if found != body:
+            tmpl = 'Expected file contents %r but found %r'
+            raise self.TestFailure(tmpl, body, found)
+        
             
     # Utilities:
     def run_tahoe(self, *args):