]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Help for admin commands: cosmetics and new tests.
authorDaira Hopwood <daira@jacaranda.org>
Fri, 16 Oct 2015 16:56:15 +0000 (17:56 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Fri, 16 Oct 2015 16:56:15 +0000 (17:56 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/scripts/admin.py
src/allmydata/test/test_cli.py

index 6dab86ab7b03f3255220a14073bc538dbe63159e..23ac8a1abe934a6c176641e4f111d03e3b5bfbd6 100644 (file)
@@ -3,12 +3,13 @@ from twisted.python import usage
 from allmydata.scripts.common import BaseOptions
 
 class GenerateKeypairOptions(BaseOptions):
+    def getSynopsis(self):
+        return "Usage: %s [global-options] 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
 
@@ -24,14 +25,13 @@ class DerivePubkeyOptions(BaseOptions):
         self.privkey = privkey
 
     def getSynopsis(self):
-        return "Usage: tahoe [global-options] admin derive-pubkey PRIVKEY"
+        return "Usage: %s [global-options] 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 756589b39ac3115e0ec82d46373cc7eb7eac41b1..c3a6686029956a653d719ce4664d80614e350543 100644 (file)
@@ -17,10 +17,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]
 
@@ -615,6 +615,18 @@ class Help(unittest.TestCase):
             subhelp = str(oClass())
             self.failUnlessIn(" [global-options] debug flogtool %s " % (option,), subhelp)
 
+    def test_create_admin(self):
+        help = str(admin.AdminCommand())
+        self.failUnlessIn(" [global-options] admin SUBCOMMAND", help)
+
+    def test_create_admin_generate_keypair(self):
+        help = str(admin.GenerateKeypairOptions())
+        self.failUnlessIn(" [global-options] admin generate-keypair", help)
+
+    def test_create_admin_derive_pubkey(self):
+        help = str(admin.DerivePubkeyOptions())
+        self.failUnlessIn(" [global-options] admin derive-pubkey", help)
+
 
 class Ln(GridTestMixin, CLITestMixin, unittest.TestCase):
     def _create_test_file(self):