mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-31 08:25:35 +00:00
test_cli.py: Test for error message when 'tahoe rm' is invoked without a path. refs #1292
This commit is contained in:
parent
a85a462a7a
commit
00fefeba49
@ -2942,6 +2942,12 @@ class Mkdir(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
|
||||
|
||||
class Rm(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
def _create_test_file(self):
|
||||
data = "puppies" * 1000
|
||||
path = os.path.join(self.basedir, "datafile")
|
||||
fileutil.write(path, data)
|
||||
self.datafile = path
|
||||
|
||||
def test_rm_without_alias(self):
|
||||
# 'tahoe rm' should behave sensibly when invoked without an explicit
|
||||
# alias before the default 'tahoe' alias has been created.
|
||||
@ -2975,6 +2981,26 @@ class Rm(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
d.addCallback(_check)
|
||||
return d
|
||||
|
||||
def test_rm_without_path(self):
|
||||
# 'tahoe rm' should give a sensible error message when invoked without a path.
|
||||
self.basedir = "cli/Rm/rm_without_path"
|
||||
self.set_up_grid()
|
||||
self._create_test_file()
|
||||
d = self.do_cli("create-alias", "tahoe")
|
||||
d.addCallback(lambda ign: self.do_cli("put", self.datafile, "tahoe:test"))
|
||||
def _do_rm((rc, out, err)):
|
||||
self.failUnlessReallyEqual(rc, 0)
|
||||
self.failUnless(out.startswith("URI:"), out)
|
||||
return self.do_cli("rm", out.strip('\n'))
|
||||
d.addCallback(_do_rm)
|
||||
|
||||
def _check((rc, out, err)):
|
||||
self.failUnlessReallyEqual(rc, 1)
|
||||
self.failUnlessIn("path must be given", err)
|
||||
self.failUnlessReallyEqual(out, "")
|
||||
d.addCallback(_check)
|
||||
return d
|
||||
|
||||
|
||||
class Stats(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
def test_empty_directory(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user