From: Brian Warner Date: Mon, 4 Aug 2008 20:26:43 +0000 (-0700) Subject: test_cli: more coverage for 'tahoe put' modifying a mutable file in-place, by filenam... X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/install.html?a=commitdiff_plain;h=45d12baba2449fc1117a1f1d7965a7859d13f17a;p=tahoe-lafs%2Ftahoe-lafs.git test_cli: more coverage for 'tahoe put' modifying a mutable file in-place, by filename, closes #441 --- diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index b1788653..5fdf6f40 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -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 + +