From 770f976a850082fdc139eb9d6897e4aeacd6c108 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 16 Feb 2009 15:08:33 -0700 Subject: [PATCH] test_cli: add test coverage for help strings --- src/allmydata/scripts/cli.py | 2 +- src/allmydata/test/test_cli.py | 48 ++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py index 87d6b279..da1a1374 100644 --- a/src/allmydata/scripts/cli.py +++ b/src/allmydata/scripts/cli.py @@ -172,7 +172,7 @@ class RmOptions(VDriveOptions): self.where = where def getSynopsis(self): - return "%s rm VE_FILE" % (os.path.basename(sys.argv[0]),) + return "%s rm VDRIVE_FILE" % (os.path.basename(sys.argv[0]),) class MvOptions(VDriveOptions): def parseArgs(self, frompath, topath): diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index 1ee4b9f2..5cd58cc9 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -272,6 +272,54 @@ class CLI(unittest.TestCase): "didn't see 'mqfblse6m5a6dh45isu2cg7oji' in '%s'" % err) +class Help(unittest.TestCase): + + def test_get(self): + help = str(cli.GetOptions()) + self.failUnless("get VDRIVE_FILE LOCAL_FILE" in help, help) + self.failUnless("% tahoe get FOO |less" in help, help) + + def test_put(self): + help = str(cli.PutOptions()) + self.failUnless("put LOCAL_FILE VDRIVE_FILE" in help, help) + self.failUnless("% cat FILE | tahoe put" in help, help) + + def test_rm(self): + help = str(cli.RmOptions()) + self.failUnless("rm VDRIVE_FILE" in help, help) + + def test_mv(self): + help = str(cli.MvOptions()) + self.failUnless("mv FROM TO" in help, help) + + def test_ln(self): + help = str(cli.LnOptions()) + self.failUnless("ln FROM TO" in help, help) + + def test_backup(self): + help = str(cli.BackupOptions()) + self.failUnless("backup FROM ALIAS:TO" in help, help) + + def test_webopen(self): + help = str(cli.WebopenOptions()) + self.failUnless("webopen [ALIAS:PATH]" in help, help) + + def test_manifest(self): + help = str(cli.ManifestOptions()) + self.failUnless("manifest [ALIAS:PATH]" in help, help) + + def test_stats(self): + help = str(cli.StatsOptions()) + self.failUnless("stats [ALIAS:PATH]" in help, help) + + def test_check(self): + help = str(cli.CheckOptions()) + self.failUnless("check [ALIAS:PATH]" in help, help) + + def test_deep_check(self): + help = str(cli.DeepCheckOptions()) + self.failUnless("deep-check [ALIAS:PATH]" in help, help) + class CLITestMixin: def do_cli(self, verb, *args, **kwargs): nodeargs = [ -- 2.45.2