]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Help for admin commands: cosmetics and new tests.
authorDaira Hopwood <david-sarah@jacaranda.org>
Thu, 16 May 2013 18:29:22 +0000 (19:29 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Wed, 9 Apr 2014 00:44:25 +0000 (01:44 +0100)
Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
src/allmydata/scripts/admin.py
src/allmydata/test/test_cli.py

index 092d90a9c143c10c7dd03e971a477098deac3a1d..627792f72f1c03a5eb71525abfe2096a092fcd18 100644 (file)
@@ -4,13 +4,12 @@ from allmydata.scripts.common import BaseOptions
 
 class GenerateKeypairOptions(BaseOptions):
     def getSynopsis(self):
-        return "Usage: tahoe [global-opts] admin generate-keypair"
+        return "Usage: %s [global-opts] admin generate-keypair" % (self.command_name,)
 
     def getUsage(self, width=None):
         t = BaseOptions.getUsage(self, width)
         t += """
-Generate a public/private keypair, dumped to stdout as two lines of ASCII..
-
+Generate a public/private keypair, dumped to stdout as two lines of ASCII.
 """
         return t
 
@@ -26,14 +25,13 @@ class DerivePubkeyOptions(BaseOptions):
         self.privkey = privkey
 
     def getSynopsis(self):
-        return "Usage: tahoe [global-opts] admin derive-pubkey PRIVKEY"
+        return "Usage: %s [global-opts] admin derive-pubkey PRIVKEY" % (self.command_name,)
 
     def getUsage(self, width=None):
         t = BaseOptions.getUsage(self, width)
         t += """
 Given a private (signing) key that was previously generated with
 generate-keypair, derive the public key and print it to stdout.
-
 """
         return t
 
index 8de2356b88a52c5bd29d52c49e94d1a82d858f1e..0f0a2d7f1f313186824a3141c432ded73f886e06 100644 (file)
@@ -18,10 +18,10 @@ import allmydata.scripts.common_http
 from pycryptopp.publickey import ed25519
 
 # Test that the scripts can be imported.
-from allmydata.scripts import create_node, debug, keygen, startstop_node, \
+from allmydata.scripts import create_node, admin, debug, keygen, startstop_node, \
     tahoe_add_alias, tahoe_backup, tahoe_check, tahoe_cp, tahoe_get, tahoe_ls, \
     tahoe_manifest, tahoe_mkdir, tahoe_mv, tahoe_put, tahoe_unlink, tahoe_webopen
-_hush_pyflakes = [create_node, debug, keygen, startstop_node,
+_hush_pyflakes = [create_node, admin, debug, keygen, startstop_node,
     tahoe_add_alias, tahoe_backup, tahoe_check, tahoe_cp, tahoe_get, tahoe_ls,
     tahoe_manifest, tahoe_mkdir, tahoe_mv, tahoe_put, tahoe_unlink, tahoe_webopen]
 
@@ -607,6 +607,18 @@ class Help(unittest.TestCase):
             subhelp = str(oClass())
             self.failUnlessIn(" [global-opts] debug flogtool %s " % (option,), subhelp)
 
+    def test_create_admin(self):
+        help = str(admin.AdminCommand())
+        self.failUnlessIn(" [global-opts] admin SUBCOMMAND", help)
+
+    def test_create_admin_generate_keypair(self):
+        help = str(admin.GenerateKeypairOptions())
+        self.failUnlessIn(" [global-opts] admin generate-keypair", help)
+
+    def test_create_admin_derive_pubkey(self):
+        help = str(admin.DerivePubkeyOptions())
+        self.failUnlessIn(" [global-opts] admin derive-pubkey", help)
+
 
 class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase):