]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test_cli: more coverage for 'tahoe put' modifying a mutable file in-place, by filenam...
authorBrian Warner <warner@lothar.com>
Mon, 4 Aug 2008 20:26:43 +0000 (13:26 -0700)
committerBrian Warner <warner@lothar.com>
Mon, 4 Aug 2008 20:26:43 +0000 (13:26 -0700)
src/allmydata/test/test_cli.py

index b1788653737a3bb43dd4405d1690d06238fc33f5..5fdf6f403f1f8663e0001c60f952e2b1057c494d 100644 (file)
@@ -442,7 +442,32 @@ class Put(SystemTestMixin, CLITestMixin, unittest.TestCase):
         return d
 
     def test_mutable(self):
-        # tahoe put --mutable file.txt uploaded.txt
-        # tahoe put - uploaded.txt  # should modify-in-place
-        pass # TODO
+        # echo DATA1 | tahoe put --mutable - uploaded.txt
+        # echo DATA2 | tahoe put - uploaded.txt # should modify-in-place
+        # tahoe get uploaded.txt, compare against DATA2
+
+        self.basedir = os.path.dirname(self.mktemp())
+        DATA1 = "data" * 100
+        fn1 = os.path.join(self.basedir, "DATA1")
+        f = open(fn1, "w")
+        f.write(DATA1)
+        f.close()
+        DATA2 = "two" * 100
+        fn2 = os.path.join(self.basedir, "DATA2")
+        f = open(fn2, "w")
+        f.write(DATA2)
+        f.close()
+
+        d = self.set_up_nodes()
+        d.addCallback(lambda res: self.do_cli("create-alias", "tahoe"))
+        d.addCallback(lambda res:
+                      self.do_cli("put", "--mutable", fn1, "tahoe:uploaded.txt"))
+        d.addCallback(lambda res:
+                      self.do_cli("put", fn2, "tahoe:uploaded.txt"))
+        d.addCallback(lambda res:
+                      self.do_cli("get", "tahoe:uploaded.txt"))
+        d.addCallback(lambda (out,err): self.failUnlessEqual(out, DATA2))
+        return d
+
+