test_cli: add test coverage for help strings

This commit is contained in:
Brian Warner 2009-02-16 15:08:33 -07:00
parent ebe0f2ac08
commit 770f976a85
2 changed files with 49 additions and 1 deletions

View File

@ -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):

View File

@ -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 = [