From 30b3eb75d919117727b1b934893c6a87a18794be Mon Sep 17 00:00:00 2001
From: Daira Hopwood <daira@jacaranda.org>
Date: Fri, 10 Jul 2015 05:48:26 +0100
Subject: [PATCH] Help for admin commands: cosmetics and new tests.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---
 src/allmydata/scripts/admin.py |  4 +---
 src/allmydata/test/test_cli.py | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/allmydata/scripts/admin.py b/src/allmydata/scripts/admin.py
index 6dab86ab..af6a93f5 100644
--- a/src/allmydata/scripts/admin.py
+++ b/src/allmydata/scripts/admin.py
@@ -7,8 +7,7 @@ class GenerateKeypairOptions(BaseOptions):
     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
 
@@ -31,7 +30,6 @@ class DerivePubkeyOptions(BaseOptions):
         t += """
 Given a private (signing) key that was previously generated with
 generate-keypair, derive the public key and print it to stdout.
-
 """
         return t
 
diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py
index e1f2ed88..3a0766b7 100644
--- a/src/allmydata/test/test_cli.py
+++ b/src/allmydata/test/test_cli.py
@@ -16,10 +16,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-options] 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 Ln(GridTestMixin, CLITestMixin, unittest.TestCase):
     def _create_test_file(self):
-- 
2.45.2