]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Improve 'tahoe put --help' to clarify behaviour for mutable files, and
authorDavid-Sarah Hopwood <david-sarah@jacaranda.org>
Wed, 20 Mar 2013 01:27:17 +0000 (01:27 +0000)
committerDavid-Sarah Hopwood <david-sarah@jacaranda.org>
Wed, 20 Mar 2013 01:27:17 +0000 (01:27 +0000)
make sure the documented behaviour is tested. fixes #1372

Signed-off-by: David-Sarah Hopwood <david-sarah@jacaranda.org>
src/allmydata/scripts/cli.py
src/allmydata/test/test_cli.py

index 6758fe7d7b6e36f7c04339a13694987fcae77cfc..343a572807b3d7997167aa04199891e7e65dd4bb 100644 (file)
@@ -208,7 +208,11 @@ class PutOptions(VDriveOptions):
     If REMOTE_FILE is missing, upload the file but do not link it into a
     directory; also print the new filecap to stdout. If LOCAL_FILE is missing
     or '-', data will be copied from stdin. REMOTE_FILE is assumed to start
-    with tahoe: unless otherwise specified."""
+    with tahoe: unless otherwise specified.
+
+    If the destination file already exists and is mutable, it will be modified
+    in-place, whether or not --mutable is specified. (--mutable only affects
+    creation of new files.)"""
 
     def getUsage(self, width=None):
         t = VDriveOptions.getUsage(self, width)
index 333da02a321aa90937668ca7ab943349ccd94192..d4c26de838afaedda5fd230fdef87844a69a6955 100644 (file)
@@ -1173,8 +1173,20 @@ class Put(GridTestMixin, CLITestMixin, unittest.TestCase):
         d = self.do_cli("create-alias", "tahoe")
         d.addCallback(lambda res:
                       self.do_cli("put", "--mutable", fn1, "tahoe:uploaded.txt"))
+        def _check(res):
+            (rc, out, err) = res
+            self.failUnlessEqual(rc, 0, str(res))
+            self.failUnlessEqual(err, "", str(res))
+            self.uri = out
+        d.addCallback(_check)
         d.addCallback(lambda res:
                       self.do_cli("put", fn2, "tahoe:uploaded.txt"))
+        def _check2(res):
+            (rc, out, err) = res
+            self.failUnlessEqual(rc, 0, str(res))
+            self.failUnlessEqual(err, "", str(res))
+            self.failUnlessEqual(out, self.uri, str(res))
+        d.addCallback(_check2)
         d.addCallback(lambda res:
                       self.do_cli("get", "tahoe:uploaded.txt"))
         d.addCallback(lambda (rc,out,err): self.failUnlessReallyEqual(out, DATA2))