Improve 'tahoe put --help' to clarify behaviour for mutable files, and

make sure the documented behaviour is tested. fixes #1372

Signed-off-by: David-Sarah Hopwood <david-sarah@jacaranda.org>
This commit is contained in:
David-Sarah Hopwood 2013-03-20 01:27:17 +00:00
parent ef0a6c3015
commit 656e819560
2 changed files with 17 additions and 1 deletions

View 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)

View 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))